Stocks extended gains on Tuesday as volatile oil prices and the latest developments in the United States-Israeli war with Iran broadly impacted investor sentiment.

The Dow Jones Industrial Average (DIA  ) climbed nearly 50 points to close at 46,993.26, while the S&P 500 Index (SPY  ) added 0.25% and the Nasdaq Composite (QQQ  ) rose 0.5% to settle at 6,716.09 and 22,479.52, respectively.

Oil prices resumed their recent stretch of gains on Tuesday after posting minor losses in the previous session. Domestic benchmark West Texas Intermediate rose 2.9% to settle at $96.21 a barrel, while international benchmark Brent crude futures also climbed about 3% to close at $103.42 per barrel.

President Donald Trump told White House reporters on Tuesday that the nation's NATO allies are "making a very foolish mistake," by not joining the United States in its war with Iran by supporting oil tankers passing through the Strait of Hormuz. Trump said that the alliance of 32 European and North American nations' hesitance "a great test, because we don't need them, but they should have been there."

Despite those gains, consumer discretionary stocks related to American Airlines (AAL  ) and Delta Air Lines (DAL  ) rose higher on Tuesday after the carriers raised their forward guidances' for the current quarter. Other travel sector gainers included Expedia Group (EXPE  ) and Booking Holdings (BKNG  ).

American Airlines said in a securities filing on Tuesday that it expects total revenue to rise by more than 10% in its current quarter, above its prior guidance range of 7% to 10%, as demand remains strong. Chief Executive Officer Robert Isom said during a conference hosted by JPMorgan on Tuesday that its first quarter revenue growth is "incredibly strong," and that the airline expects "that progressing as we move through the year."

Delta Air Lines now forecasts for first quarter revenue to increase at a high-single-digit percentage, as higher revenue is "offsetting the cost of not just the fuel," but the carrier's "pretty tough winter season in terms of storms," CEO Ed Bastian told CNBC's Phil LeBeau on Tuesday.

For Wednesday, market participants will turn their attention towards the Federal Reserve's next policy decision. Central bankers are broadly expected to hold interest rates at their current level of 3.50% to 3.75%, according to CME Group's FedWatch tool.

Key earnings reports for Wednesday include Lululemon Athletica (NASDAQ: LULU), DocuSign (DOCU  ), General Mills (GIS  ), Williams-Sonoma (WSM  ), and Macy's (M  ).