Stocks gained on Tuesday on the heels of a strong October retail sales report and better-than-expected third quarter results from giants like Home Depot (HD  ) and Walmart (WMT  ), signalling a positive holiday season ahead for the sector despite inflationary pressures.

Here's how the market settled on Tuesday:

S&P 500 Index (SPY  ): +0.39% or +18.10 points to 4,700.90

Dow Jones Industrial Average (DIA  ): +0.15% or +54.77 points to 36,142.22

Nasdaq Composite Index (QQQ  ): +0.76% or +120.01 points to 15,973.86

Goldman Sachs bullish on earnings growth through 2022:

Goldman Sachs (GS  ) strategist David Kostin issued bullish outlook for upcoming earnings seasons for at least 2022 on Tuesday, adding that he expects continued growth to drive the S&P 500 to 5,100 by the end of next year.

"Profit growth has accounted for the entire S&P 500 return in 2021 and will continue to drive gains in 2022," Kostin wrote in a note to clients, quoted by CNBC. "S&P 500 EPS will grow by 8% to $226 in 2022 and by 4% to $236 in 2023. Our EPS estimates is 2% above 2022 bottom-up consensus. Companies have consistently expanded profit margins despite input cost pressures and supply chain challenges."

Import prices soar higher in October:

The cost of imports rose by a greater-than-expected margin in October over September, according to the Commerce Department's report published Tuesday, signalling that inflationary pressures are still impacting economic recovery.

Import prices rose 1.2% on a monthly basis in October, soaring well above the 0.4% rise posted in September and coming above the 1.0% increase expected by consensus economists.

Retail sales jumped higher in October, third straight month of gains:

U.S. retail sales came in higher than expected in October, rising for a third straight month, as the U.S. consumer continues to spend strongly ahead of the holiday season despite the rising cost of goods.

Retail sales rose by 1.7% month-over-month in October, according to the Commerce Department's report published Tuesday, topping consensus economists estimates for growth of 1.4% and September's upwardly revised print of 0.8%.

Driving the monthly boost, e-commerce sales saw a 4.0% increase, while gasoline station sales climbed 3.9% higher and electronics and appliance stores posted a gain of 3.8%. However, some categories associated with economic reopening saw slowed momentum, with food service and drinking places sales falling flat and clothing and clothing accessory store sales fell by 0.7%.

Here's how market benchmarks started trading soon after open:

S&P 500 Index: +0.00% or +0.17 points to 4,682.97

Dow Jones Industrial Average: +0.17% or +62.20 points to 36,149.65

Nasdaq Composite Index: -0.15% or -23.90 points to 15,829.95