SAN FRANCISCO (MarketWatch) — U.S. financial stocks closed higher Tuesday, led by strong bank gains, as investors were optimistic about Federal Reserve officials discussing ways to stimulate the economy.

A better-than-expected Spanish debt auction and a jump in U.S. building permits reinforced bullish sentiment.

Leading banks higher were shares of Bank of America Corp. BAC, +1.55% and Citigroup Inc. C, +1.88% , chalking up gains of 4.5% and 3.5%, respectively.

Jamie Dimon, chairman and CEO of J.P. Morgan Chase. Reuters

Shares of J.P. Morgan Chase & Co. JPM, +1.46% traded up 2.2% as Chief Executive Jamie Dimon returned to Capitol Hill to answer questions before a House committee about the bank’s recent $2 billion-plus derivatives trading loss. Read more on Jamie Dimon’s testimony.

The Financial Select Sector SPDR ETF XLF, +1.53% , which follows financial stocks in the S&P 500 Index SPX, +1.00% , rose 1.7%. The KBW Bank Index BKX, +1.87% , which tracks the 24 leading U.S. banks, advanced 2%.

Other banks showing strong gains of 3% or more included SunTrust Banks Inc. STI, -0.20% , Zions Bancorp. ZION, +1.79% , First Horizon National Corp. FHN, +2.87% and KeyCorp KEY, +1.81%

The sector helped lead the broader market higher in anticipation of more stimulus measures as the Federal Open Market Committee kicked off its two-day meeting on monetary policy and the U.S.economy. Read more on Federal Reserve.

In Spain, a debt auction saw the sale of 3.039 billion euros ($3.844 billion) of short-term bills, exceeding a target range of €2 billion to €3 billion, although at sharply higher yields. Read more on Spanish bond auction.

J.P. Morgan whale’s choppy waters

Also Tuesday, the Commerce Department said building permits rose to a four-year high even though starts on new homes declined in May. Read more on housing data.

Notable financial stocks with gains of about 3% or more included Morgan Stanley MS, +2.13% , Goldman Sachs Group Inc. GS, +2.95% , MetLife Inc. MET, +0.87% , Genworth Financial Inc. GNW, -1.71% , Lincoln National Corp. LNC, +2.03% , and Hartford Financial Services Group Inc. HIG, +1.60% .

Shares of Discover Financial Services DFS, +4.85% closed up 2.3%, reversing an initial decline precipitated by second-quarter financial results.

Profit for the three months ended May 31 fell 11% after accounting for rising loan-loss provisions. Total loans rose 8.6% from the prior year to $57.06 billion, while Discover’s credit-card loans grew 3.7% to $46.61 billion.

Provision for loan losses was $232 million, up from $176 million a year ago and $152 million in the prior quarter.