NEW YORK (MarketWatch) — The U.S. stock market rallied on Friday, sending the S&P 500 and Dow Jones Industrial Average into record territory, after a surprise stimulus plan from the Bank of Japan was announced.

Some analysts noted that the recovery from the recent pullback, which sent the S&P 500 down nearly 8% early this month, was the second fastest recovery since 2010. The main benchmarks finished the week and the month higher.

The measures announced by Japan appeared to encourage investors, who have been looking for regions like Europe and Asia to take further steps toward boosting flagging growth, as the Federal Reserve wraps its own stimulus program.

The S&P 500 SPX, -1.81% closed at a record high, having rung up a new closing high every month since June 2013, according to Howard Silverblatt, senior index analyst at S&P Dow Jones Indices.

The benchmark index gained 23.40 points, or 1.2%, to 2,018.05 on Friday.

The Dow Jones Industrial Average DJIA, -2.26% also closed at a record level, having hit an intraday high in morning session. The blue-chip index rose 195.10 points, or 1.1%, to 17,390.52, and recorded its biggest weekly gain in nearly two years. The Dow swung wildly during October - moving triple-digits 16 times out of 23, but still ended the month higher.

The Nasdaq Composite COMP, -1.23% rallied 64.60 points, or 1.4%, to 4,630.74 and closed at the highest level since March 2000.

Global stocks were boosted by the Bank of Japan’s surprise increase in its stimulus, with the Nikkei 225 index soaring nearly 5%. The BOJ board voted 5-4 in favor of increasing the central bank’s annual asset purchases to 80 trillion yen, from a prior target range of ¥60 trillion to ¥70 trillion, amid worries about dwindling inflation and downbeat economic data.

Investors did not dwell on softer-than-expected economic reports on consumer spending and labor costs. Consumer spending in the U.S. fell in September for the first time in eight months, while employment costs rose for the second straight quarter to mark the biggest back-to-back gain since 2008.

“The U.S. sends 4.5% of it exports to Japan, and so any action that can: (a) ward off the threat of deflation and the crippling effect that has on consumer expenditure; (b) give a boost to the Japanese economy, which is the world’s third largest, has to be seen as a strong positive for future earnings potential,” said Stephen Pope, managing partner at Spotlight Ideas.

More data at month’s end: The final October reading on the University of Michigan/Thomson Reuters consumer-sentiment index rose to the highest level since July 2007.

Separately, Chicago PMI rose to a one-year high in October, helped by gains in new orders, MNI Indicators said Friday.

Stocks to watch: GoPro Inc. GPRO, -1.61% surged after results topped Wall Street estimates.

AbbVie Inc. ABBV, -2.13% shares rallied after the company said sales and profit beat analyst forecasts.

Madison Square Garden Co. US:MSG shares rose after its fiscal first quarter revenue far surpassed analyst estimates. The company is currently considering splitting itself in two.

Starbucks Corp. SBUX, -3.19% is down after its first-quarter outlook fell below forecasts.

Shares of Apple Inc. AAPL, +0.02% hit an intraday record in morning trade and shares gained 34% since the start of the year.