U.S. stocks rallied Tuesday as voters headed to the polls on the last day of the presidential election and as more data piled up showing the economy remains solid.

The S&P 500 rose 1.2% to pull closer to its record set last month. The Dow Jones industrial average climbed 427 points, or 1%, while the Nasdaq composite gained 1.4%.

The market got a lift from a report showing growth accelerated last month for retailers, transportation companies and other businesses in the U.S. services industries. That was despite economists’ expectations for a slowdown, and the Institute for Supply Management said it was the strongest growth in more than two years.

The report offered more hope that the U.S. economy will remain solid and avoid a long-feared recession following the worst inflation in generations.

Excitement about the artificial-intelligence boom also helped lift the stock market, as it has for much of the last year. Software company Palantir Technologies jumped 23.5% after delivering bigger profit and revenue than analysts expected for the latest quarter.

It helped offset a 5.2% drop for NXP Semiconductors. The Dutch company fell to one of the largest losses in the S&P 500 after warning that weakness it saw in the industrial and other markets during the latest quarter is spreading to Europe and the Americas.

All told, the S&P 500 rose 70.07 points to 5,782.76. The Dow gained 427.28 to 42,221.88, and the Nasdaq composite rallied 259.19 to 18,439.17.

The market’s main event Tuesday was the election, even if the result may not be known for days or weeks as officials count all the votes.

Since 1945, the S&P 500 has risen in 73% of the years where a Democrat was president and 70% of the years when a Republican was the nation’s chief executive, according to Sam Stovall, chief investment strategist at CFRA.

The U.S. stock market has risen more in magnitude when Democrats have been president, in part because a loss under George W. Bush’s term hurt the Republicans’ average.

Besides who will be president, other questions hanging over the market include whether the White House will be working with a unified Congress or one split by political parties, as well as whether the results will be contested.

In the bond market, the yield on the 10-year Treasury initially rallied following Tuesday morning’s strong report on U.S services businesses but pared the gain later in the day. It slipped to 4.28% from 4.29% late Monday.

— Associated Press