U.S. stocks closed higher Tuesday, rallying amid a midterm election that could result in a politically split and potentially gridlocked government.

The Dow Jones Industrial Average rose 333.83 points, or 1.02%, to close at 33,160.83. The S&P 500 rose 21.31 points, or to close at 0.56%, to 3,828.11, and the Nasdaq Composite rose 51.68 points, or 0.49%, to close at 10,616.20.

Polls showed Republicans likely to reclaim a majority in the House of Representatives and competing to retake control of the U.S. Senate. Fewer regulations and major legislative proposals is expected from a politically divided government.

The Labor Department is also scheduled to release the consumer price index for October on Thursday. The CPI compiles the prices of common goods and services and is a closely watched gauge of inflation. Analysts expect an annual increase of 7.9% -- a historically high rate of inflation. It would still represent a decrease from the 8.2% increase recorded for September.

Some of the stocks that rose included Amgen (AMGN), which closed at $292.39, rising $15.37, or 5.55%. Qualcomm's (QCOM) price of shares rose $2.45, or 2.23%, to close at $112.54.

"If we have a gridlock, that will probably be the best thing that could happen for the market," Wealth Alliance analyst Seth Cohan told CNBC. "The markets usually do very well when that happens."