U.S. stocks rose slightly on Tuesday, the final trading day of the month, and posted another solid monthly gain.

The and the Dow Jones industrial average rose 2.2 percent and 4.3 percent, respectively, in October. The two indexes also notched their seventh straight monthly gain. October has historically been one of the most turbulent months for stocks.

The S&P 500 "ends October in much better shape than many had anticipated. Price action remains strong, as do the upcoming seasonals," Frank Cappelleri, executive director at Instinet, said in a note Tuesday.

More than half of the S&P 500's gains came from just five stocks, however, according to Standard & Poor's: Facebook, Amazon, Apple, Google-parent Alphabet and Microsoft. All of these companies, except for Apple, have already reported blockbuster quarterly earnings, sending their shares higher (Apple will release its latest quarterly figures Thursday after the close).

These stocks have also helped lift the Nasdaq composite 3.6 percent in October. The index recorded its fourth straight monthly gain and closed at a record high.

Overall, tech stocks had a great month. The sector gained 7.7 percent in October, its best monthly gain since July 2016.

Wall Street will start off November staring down several key events. First, the Federal Reserve is scheduled to announce its latest monetary policy decision on Wednesday.

However, most investors are not expecting any changes in policy. Market expectations for a Fed rate hike Wednesday are just 2 percent, according to the CME Group's FedWatch tool. Rather, the Fed is expected to raise rates in December.

"The Fed is likely to continue on its gradual tightening path, but so far this tightening has had little effect on longer-term rates," said Jason Pride, director of investment strategy at Glenmede, in a note.

"Demand for longer-term debt has been strong enough to offset the Fed's efforts so far, as the aging global population has driven increased need for fixed income investments," Pride said.