NEW YORK (Reuters) - The S&P 500 stock index closed at a more than five-month high on Tuesday, boosted by expectations for strong earnings, while the U.S. dollar rose against the safe-haven Japanese yen as waning trade war fears drove a bid for riskier assets.

FILE PHOTO: Traders work on the floor of the New York Stock Exchange (NYSE) in New York, U.S., July 6, 2018. REUTERS/Brendan McDermid

World equities markets remained near three-week highs, supported by the optimism on U.S. company earnings and expectations that global economic growth can withstand trade tensions.

“The market is in a very optimistic mood. The economic data is very strong and the labor markets are strong, and companies are making a lot of money,” said Randy Frederick, vice president of trading and derivatives for Charles Schwab in Austin, Texas.

PepsiCo shares surged more than 5 percent after the soft drinks maker reported quarterly results that topped estimates on strong sales of snacks.

The Dow Jones Industrial Average rose 143.07 points, or 0.58 percent, to 24,919.66, the S&P 500 gained 9.67 points, or 0.35 percent, to 2,793.84, and the Nasdaq Composite added 3.00 points, or 0.04 percent, to 7,759.20. The S&P’s close was its highest since Feb. 1.

Oil rose on supply concerns in Norway and Libya, though gains were tempered by the United States’ indication that it would consider requests for waivers from Iranian oil sanctions. The gains helped drive energy shares higher on Wall Street.

Brent crude, up almost 20 percent this year, was last at $78.82, or 0.96 percent higher on the day. U.S. crude rose 0.26 percent to $74.04 per barrel.

U.S. companies are expected to report second-quarter earnings growth of over 20 percent across all sectors when earnings season kicks off this week, thanks to recent tax cuts, high oil prices and robust economic growth.

To view a graphic on S&P500 earnings Q2, click: reut.rs/2IWAdDf

To view a graphic on Tech and banks win from US corporate tax cuts, click: reut.rs/2JaOigB

The pan-European FTSEurofirst 300 index rose 0.40 percent and MSCI’s gauge of stocks across the globe gained 0.26 percent.

U.S. Treasury yields hit session highs after a weak 3-year notes auction, which caused the yield to flatten further with the spread between U.S. Treasury 5-year and 30-year yields contracting to under 20 basis points.

Benchmark 10-year notes last fell 3/32 in price to yield 2.8692 percent, from 2.86 percent late on Monday.

To view a graphic on Ups and downs of world stocks in 2018, click: reut.rs/2L2jwrT

The risk-on sentiment nudged the U.S. dollar closer to a seven-week high against the yen. The greenback could be poised for a further boost if consumer price inflation figures come in higher than expected on Thursday.

The dollar index rose 0.07 percent, with the euro down 0.05 percent to $1.1743.

Emerging market currencies like the Mexican peso, Brazilian real and Russian rouble also rose on global economic momentum.

In Turkey, President Tayyip Erdogan’s new cabinet lacked market-friendly names and included instead his son-in-law as finance minister.

The Turkish lira gained ground. The U.S. dollar was down 0.6 percent against the lira.

To view a graphic on Turkey's financial market strains, click: reut.rs/2Ja8bVc