Wells Fargo & Co said on Wednesday it had agreed to pay $1.2 billion to settle claims that it engaged in mortgage fraud, resolving a major U.S. lawsuit brought in the wake of the 2008 financial crisis.