October probably isn't the favorite month for many investors. Some of the market's biggest crashes in history occurred during the month. While the average return for the S&P 500 in October has been positive, the major index fell more than 2% last month.

There were nonetheless some big winners. Here are the three best-performing stocks in the S&P 500 in October -- and whether or not they're still good picks to buy.

1. Allstate

Investors were in good hands with Allstate (ALL -1.32%) last month. The insurance stock soared 15% -- almost enough to wipe out the previous year-to-date decline.

Allstate stock enjoyed a nice boost in the middle of October thanks to positive third-quarter results from a rival. This competitor also happens to be on our list of the S&P 500's top performers last month.

Good news for this rival contributed to investors' optimism about Allstate's own Q3 results. Sure enough, the company lived up to those increased expectations by beating Wall Street's estimates with the Q3 numbers announced on Nov. 1, 2023.

Allstate's revenue jumped 9.8% year over year to nearly $14.5 billion, well above the consensus estimate of $13.2 billion. The company posted Q3 adjusted earnings of $214 million, or $0.81 per share, higher than the average analysts' estimate of $0.48 per share.

2. Progressive

In case you were wondering what the unnamed Allstate rival mentioned earlier was, I'll end the suspense: It was Progressive (PGR -0.97%). Like Allstate, Progressive delivered a solid performance in October with its shares jumping 13.5% higher.

On Oct. 13, Progressive reported Q3 results that trounced Wall Street's expectations. The big insurer announced earnings of $1.1 billion, or $1.89 per share, compared to $124.1 million, or $0.20 per share, in the prior-year period.

Progressive saw nice gains across its lines of business. The company's direct auto business was the biggest winner with policies in force vaulting 14% higher year over year. None of its businesses experienced year-over-year gains in the number of policies in force of less than 7%.

3. Dollar General

Not all of the S&P'5 best stocks of October were insurers. Shares of discount retailer Dollar General (DG -0.41%) rose 12.5% last month, ending a year-to-date slide of close to 60%.

On Oct. 12, Dollar General provided updated full-year guidance. The company narrowed its projected sales growth to between 1.5% and 2.5% from its previous outlook of 1.3% to 3.3%. It forecast a full-year same-store sales decline of between -1% and 0% compared to its previous guidance of a decline of -1% to growth of 1%. Dollar General also stated that it expects earnings per share of between $7.10 and $7.60. Its prior outlook was for earnings per share between $7.10 and $8.30.

Those updates weren't positive. So why did Dollar General stock rise in October? Investors welcomed the news that former CEO Todd Vasos was again taking the helm of the company. Vasos replaced embattled former CEO Jeff Owen. During Vasos' previous stint as CEO from June 2015 to November 2022, Dollar General's share price more than tripled.

Are these top S&P 500 stocks in October still buys?

Allstate and Progressive could continue to face more challenges from weather-related catastrophes. The higher costs of cars and automotive parts could also increase expenses for their auto insurance businesses. However, both companies have well-managed underwriting processes that should mitigate these risks.

As for Dollar General, I think the return of Vasos as CEO is great news for shareholders. The discount retailer's business prospects still look good. With Vasos' industry and company knowledge, Dollar General should be able to turn things around.

I wouldn't bet on Allstate, Progressive, and Dollar General repeating in November as the S&P 500's best-performing stocks. I think, though, that all three stocks are decent picks for long-term investors.