In 2022, the Nasdaq Composite index fell 33% as a spike in inflation curbed consumer and commercial spending. Countless companies posted dismal results, which led investors to bid down their stocks. However, economic improvements have allowed for a market recovery this year, and the Nasdaq has risen by 36% since Jan. 1.

That pattern highlights why holding onto your investments during poor economic conditions is crucial, and why a sell-off might be the best time to expand your portfolio. Those who sold in 2022 will not have profited from the recovery many stocks have enjoyed this year.

As such, it's not a bad idea to get familiar with some of the best stocks to buy in the event of a market downturn so you can be ready to strike if one occurs. So, here are two no-brainer stocks to buy during a stock market plunge.

1. Amazon

Amazon's (AMZN 0.58%) business proved particularly vulnerable to macroeconomic headwinds last year, and its shares fell by 50% as its e-commerce segments experienced significant declines. However, the company made an impressive turnaround in 2023, bringing its retail business back to profitability and rallying investors with an expansion in artificial intelligence (AI).

In the third quarter, Amazon's revenue rose more than 13% year over year, beating Wall Street's consensus forecast by $1.5 billion. The company benefited from solid growth in its North American segment, which posted an 11% increase in revenue and operating income of more than $4 billion. That was a massive improvement on the $412 million in operating losses the segment reported in the year-ago quarter.

After a challenging 2022, Amazon undertook several cost-cutting measures, including laying off thousands of people, closing warehouses, and shuttering unprofitable projects such as Amazon Care. These maneuvers illustrated the strength of management, with its ability to successfully navigate poor economic conditions and deliver significant growth in the company's retail segments. As a result, Amazon is heading into 2024 on better financial footing than it started this year, making it an attractive investment -- especially during a sell-off.

Amazon's business might not be as vulnerable to economic fluctuations after its recent cost-cutting moves, but its stock would likely still decline in a marketwide plunge. However, this year's comeback suggests that it wouldn't be down for long. Alongside a lucrative cloud business with Amazon Web Services and a growing position in AI, Amazon shares are an excellent option if the stock market takes a hit.

2. Apple

Apple (AAPL 0.02%) stock has gained a reputation for reliability over the years. In fact, it outperformed four of its biggest competitors in tech in 2022, as well as the Nasdaq Composite index. The company's stock proved resilient during the challenging period and became a haven for many investors.

AAPL Chart

Data by YCharts.

In 2023, macroeconomic headwinds caught up with Apple. Its revenue tumbled 3% year over year in its fiscal 2023 (which ended Sept. 30) after repeated sales declines in its product segments. Yet, its stock climbed about 46% since Jan. 1 as its history of consistent long-term gains eclipsed temporary hits to its business. Investor loyalty means Apple shares rarely go on sale, with a stock market sell-off being a compelling time to buy.

Despite poor market conditions this year, Apple's dominance in consumer tech products remains a compelling reason to invest in its stock. The company holds leading market shares in most of its product categories and has much to gain from the industry's recovery.

Moreover, Apple is heavily investing in the booming AI market, which is already worth $137 billion, and which Grand View Research projects will expand at a compound annual rate of 37% through 2030. In fiscal 2023, Apple's research and development spending rose by $3.6 billion, primarily due to its investments in generative AI.

The company's research has allowed it to develop its own large language model and make AI upgrades across its product lineup this year. Popular products such as the iPhone, Apple Watch, and AirPods Pro now offer AI features, improving the user experience and bolstering brand loyalty.

As the leader in consumer tech, Apple will likely play a crucial role in the public's adoption of AI. While most AI-minded companies are focused on the commercial sector, Apple's prioritization of consumers could grant it a lucrative position in the industry over the long term.

Over the last five years, Apple's stock rose 341%, more than Microsoft, Alphabet, or Amazon gained over that time frame. While past growth isn't always indicative of what's to come, Apple's dominance in consumer tech and its expansion into booming markets like AI will likely continue offering investors significant gains for years. The company is a screaming buy in a market downturn and an exciting long-term investment.