Stocks rose for a second day Tuesday as a commodities rally ignited broader gains and a report showed the US economy expanded at a revised 2 percent annualized rate in the third quarter, buoyed by consumer spending. GDP data “continues to tell us the same thing,’’ said Michael Arone, at State Street Global Advisors in Boston — that “the consumer is in reasonable shape, and exports are continuing to struggle.’’ Businesses are coping with weaker overseas economic growth and a strong dollar, which makes US goods more expensive abroad. The two most beaten-down industries this year, energy and raw-materials, led most of Tuesday’s advance, keeping alive prospects for a year-end stocks rally. Caterpillar surged 4.9 percent, while Walmart gained 1.7 percent. Chipotle Mexican Grill fell, however, because of investigations into its links to a new spate of gastrointestinal illnesses in three more states. Historically, the S&P 500 rises in December — the so-called Santa rally — with the final two weeks delivering an average gain of 1.7 percent. But this year, the benchmark index is down 2 percent in December and in the midst of its worst final month since 2002. After rebounding as much as 13 percent from its summer low through early November, the S&P 500 has retreated 3.4 percent, putting it on track for its biggest annual drop since the 2008 financial crisis.