U.S. stocks closed higher for the fourth straight session Tuesday as concerns about the Greek debt crisis and the Iranian nuclear deal were offset by the start of earnings season. Market professionals are now turning their attentions to Federal Reserve Chair Janet Yellen, who is due to give semiannual testimony on monetary policy before Congress on Wednesday and Thursday.

The Dow Jones Industrial Average (INDEXDJX:.DJI) gained 75.90 points, or 0.42 percent, to close at 18,053.58. The Standard & Poor's 500 index (INDEXSP:.INX) added 9.35 points, or 0.45 percent, to end at 2,108.95. And the Nasdaq composite (INDEXNASDAQ:.IXIC) rose 33.38 points, or 0.66 percent, to finish at 5,104.89.

Investors will focus on Yellen’s Humphrey Hawkins speech before Congress this week, looking for further clues as to when the Federal Reserve plans on raising rates. Last week Yellen said she expected U.S. interest rates would rise sometime this year, which would mark the first time in nearly a decade the central bank has lifted rates.

Earnings season also kicks into high gear on Wall Street this week after JPMorgan Chase & Co. (NYSE:JPM), the biggest U.S. bank by assets, beat expectations, helped by lower expenses.

JPMorgan's fiscal second-quarter net income rose to $6.3 billion, or $1.54 per share, on revenue of $24.5 billion, compared with a profit of $5.6 billion, or earnings per share of $1.46, on revenue of $25.3 billion a year ago. Analysts polled by Thomson Reuters had expected earnings per share of $1.44 on revenue of $24.5 billion.

Second-quarter earnings will continue in full swing this week as Bank of America Corp. (NYSE:BAC), Intel Corporation (NASDAQ:INTC) and Netflix Inc. (NASDAQ:NFLX) are scheduled to post quarterly results Wednesday.

Wall Street forecasts corporate earnings to have fallen 3.1 percent in the second quarter from a year ago, according to analysts polled by Thomson Reuters.

Oil prices closed higher Tuesday, rebounding after briefly tumbling 2 percent in morning trading after Iran and global powers reached a nuclear deal. Investors fear the agreement could result in easing of sanctions against Tehran and gradually increase its oil exports in an oil market already facing oversupply.

West Texas Intermediate (WTI) crude, the benchmark for U.S. oil prices, rose 1.6 percent to $53.04 per barrel for August delivery on the New York Mercantile Exchange. On the London ICE Futures Exchange, Brent crude, the global benchmark for oil prices, added 55 cents to $56.43.

Nine out of the 10 sectors in the S&P 500 closed higher Tuesday, led by gains in the healthcare and energy sectors. The utilities sector was the only decliner, shedding 0.12 percent.

UnitedHealth Group Inc. (NYSE:UNH) led the Dow higher, adding just over 2 percent, while JPMorgan (NYSE:JPM), The Coca-Cola Co. (NYSE:KO) and Chevron Corporation (NYSE:CVX) all gained more than 1 percent.

Meanwhile, shares of Twitter Inc. (NYSE:TWTR) spiked more than 7 percent Tuesday morning following a fake report claiming the social media company received a takeover bid for $31 billion. Both Twitter and Bloomberg said the story was bogus, Reuters reported. Twitter shares closed up 2.6 percent to $36.71.