Tuesday was a solid day for the stock market, with modest advances for most of the benchmark indexes stemming largely from greater optimism about the U.S. economy. As October comes to a close, stock market participants are no doubt happy we avoided a steep tumble in a month that has featured some of the most notorious downward moves in history, including the 1929 and 1987 crashes.

Readings on consumer confidence have also helped lift overall market sentiment, and news of rising wages suggests that consumers could be in a better position to spend in the near future. Companies that are in tune with those favorable trends did especially well Tuesday, and Sony (NYSE:SNE), Rockwell Automation (NYSE:ROK), and Mondelez International (NASDAQ:MDLZ) were among the best performers. Below, we'll look more closely at these stocks to tell you why they did so well.

Sony shows a pretty picture

Sony jumped 12% after the entertainment giant posted strong fiscal second-quarter results. Revenue climbed 22%, and its adjusted earnings per share were more than half again what most analysts had expected. Powered by its video game consoles, television and home entertainment systems, music, and movies, all of Sony's business units saw extremely strong sales performance. Though some argue that its competitors have taken the lead in the video game industry, Sony's diversification across the entertainment and consumer electronics sectors should continue to give it scale-based advantages over its peers.

Sony Playstation 4 with controller against a blue/purple background.

Image source: Sony.

Rockwell says no deal

Rockwell Automation picked up 7% in the wake of its decision not to accept a takeover offer from an obstinate suitor. Emerson Electric had reportedly already made previous unsolicited bids, including a $215 per share offer earlier in October. Rockwell confirmed that it had rejected the offer, arguing that a merger isn't in its best interest and saying it planned to maintain its positive momentum. However, that didn't stop shareholders from thinking that a still-higher bid might eventually persuade Rockwell to accept a deal. The market will be looking forward to the company's Nov. 8 earnings report to see if the fundamentals warrant continued confidence in this automation specialist as an independent business.

Mondelez looks tastier

Finally, Mondelez International gained 6%. The  snack food giant behind brands like Oreo and Ritz said its revenue was up a modest 2%, but that particular strength in Latin America helped to produce overall adjusted earnings gains of 12%. A malware-related incident led the company to reduce its organic net revenue growth guidance for the full 2017 year to just 1%, but it still expects greater than 10% bottom-line gains.  Mondelez investors had been hoping for solid signs of growth. The results were what they wanted to see, and gave them reason to believe in a brighter future for the company.

Dan Caplinger has no position in any of the stocks mentioned. The Motley Fool recommends Emerson Electric. The Motley Fool has a disclosure policy.