It's almost the end of the year, and investors are probably ready to move on from 2022 as the S&P 500 is down 16% as of this writing. With inflation still running hot, the Federal Reserve hiking interest rates, and an economy that continues to soften, it can be a scary time for people looking to invest their hard-earned dollars.  

In this environment, safety and stability should be prioritized. If a company has the potential for growth as well, it doesn't hurt. With $1,000 ready to put to work, investors should seriously consider buying shares of Costco Wholesale (COST 0.17%) in 2023. 

Consider the economic situation 

In Costco's fiscal 2022 fourth quarter, the retail juggernaut posted net revenue of $70.8 billion, up 15.2% from the prior-year period. Same-store sales, also known as comps, jumped 14.4%. And diluted earnings per share (EPS) came in at $4.20, good for an increase of 11.7%. 

Perhaps unsurprisingly, Costco was a major winner throughout the pandemic as consumers loaded up on all their essential needs within a single shopping trip. But Costco isn't exactly immune to the economic situation as the latest monthly financial results showed a sizable slowdown from the double-digit gains the business registered over the past couple of years. In October, net sales were up just 7.7% year over year, a still healthy number.

From an investment perspective, buying Costco stock in 2023 means that predicting the direction of the economy isn't necessary. If inflation peaks, interest rates level off, and the economy starts doing well next year, then Costco should thrive, given that the individual consumer should be in solid financial shape and willing to spend. 

On the flip side, if the U.S. enters a recession, Costco should also do well, thanks to the leadership team's intense focus on keeping prices low for customers. Consequently, this makes Costco an all-weather stock for investors. 

Costco operates a membership-based model, so its customers must pay either $60 (for the basic Gold Star plan) or $120 (for the Executive plan) in order to shop at the company's 842 warehouses. Not only do these fees drive loyalty and help generate profits, but they also allow Costco to charge rock-bottom prices for its products. This makes having the membership itself an incredible decision. 

In the latest quarter, Costco's gross margin was just 11.8%. That might seem low, but it exemplifies the company's competitive advantage. Keeping margins low on purpose helps to attract more members who spend more. And this lets Costco continue buying merchandise at low prices from its suppliers. The focus has and will always be on customers, propelling the business in 2023 and beyond. 

A look at the valuation 

Currently, Costco's stock is trading hands at a price-to-earnings ratio of 40, which is down from 49 late last year. But this valuation is greater than the trailing-five-year average of 36, a sign that investors remain optimistic about Costco's prospects. The stock has been a winner, though, producing a return of almost 450% over the past decade. 

Between fiscal 2017 and fiscal 2022, the company increased revenue and diluted EPS at a compound annual growth rate of 12% and 17%, respectively. In addition to Costco's long and successful operating history, owning the company provides investors with peace of mind, knowing that the business they own continues to post solid financial results each year. In this type of market -- one that's characterized by lots of uncertainty -- Costco's stability means something. 

Costco has become an indispensable shopping destination for its membership base, and I don't see this changing anytime soon. Customers will always want low prices, convenience, high-quality merchandise, and friendly service. This will likely always be the case, and Costco is positioned well to thrive because of it. 

As a result, it's probably a worthwhile decision to pay a premium valuation for an outstanding enterprise. If you have a long-term time horizon, then a $1,000 investment in Costco's stock in 2023 could prove to be a lucrative financial decision for your portfolio.