Purchasing stocks while the broader market is down is a great investment strategy if you choose the right stocks. The best ones to buy are those with short-term headwinds but positive prospects in the long run.

With this criterion in mind, two stocks that would be intelligent ways to deploy $10,000 are Alphabet (GOOG 0.34%) (GOOGL 0.36%) and CrowdStrike (CRWD 2.08%). Both tech companies have excellent long-term prospects and could be one of the best places to invest right now.

Alphabet

As the economy barrels toward a recession, at worst, or a reduction in spending at best, any business associated with the advertisement industry will see its stock price fall. Advertising spending is one of the first costs to be cut, and with 81% of Alphabet's second-quarter revenue coming from its advertising segment, it's right in the crosshairs of this headwind.

Despite the challenging environment, Alphabet found a way to grow its Q2 revenue by 13% year over year. Within its divisions, its largest -- Google Search & other -- set the pace with 14% growth. Lagging was its YouTube division, with a disappointing 5% growth over the prior year. However, this dichotomy shows that advertisers still believe the Google search engine is one of the best places to advertise. While ad spending is slowing now, it's sure to return when the economy recovers.

In the meantime, investors can pile into a stock that produced $12.5 billion in free cash flow and repurchased over $15 billion in shares for the quarter. Shareholder-friendly actions like share repurchases make each share more valuable. When they are executed at a time when the stock is down (Alphabet is down 22% from its all-time high), they have a more significant effect.

One business segment that performed exceptionally well in sales for Alphabet is its Google Cloud division. While unprofitable (Google Cloud lost $1.7 billion this quarter), it grew 36% from the year-ago period to $6.3 billion in sales.

Alphabet has some of the world's most iconic advertising locations, and companies will continue to spend with them -- although they may not grow their spending as rapidly now. However, in three to five years, it's unlikely Alphabet will have become a weaker company. This strength makes it one of my top stocks to buy right now.

CrowdStrike

Unlike advertising, cybersecurity is one area that isn't seeing a decrease in spending. Because cybercrime is expected to rise substantially over the following decades, businesses are getting in front of this wave by deploying top-notch cybersecurity solutions. According to third-party researcher Gartner, CrowdStrike has the premier endpoint detection and response cybersecurity offering. In plainer terms, CrowdStrike's product helps protect network endpoints (like phones and laptops) from threats. If a threat is detected, CrowdStrike can quickly stop the breach before any damage is done.

CrowdStrike's software is also wildly popular; it's utilized by 65 of the Fortune 500 and 15 of the top 20 U.S. banks. With customer count rising 57% year over year during its 2023 fiscal year Q1 (ending April 30), CrowdStrike is still rapidly growing despite having a customer base of nearly 18,000.

In Q1, annual recurring revenue (ARR) rose 61% from the year-ago quarter to $1.92 billion. However, CrowdStrike believes it can achieve a $5 billion ARR by the end of 2025 (the company's fiscal year closes in January 2026). This growth will occur by existing customers expanding their usage and continuing to grow its footprint across all industries. 

These metrics and accolades indicate CrowdStrike might be a great business -- and I believe it is. Although, the stock has two marks against it. First, CrowdStrike isn't profitable. From a net income basis, CrowdStrike lost $31.5 million during Q1 (a 6% loss margin). Yet, CrowdStrike is free-cash-flow positive and produced $158 million during the quarter (a 32% margin). While free cash flow isn't perfect, it demonstrates that the company can operate without outside funding -- something vital in today's economy.

The second mark against CrowdStrike is its high valuation. It trades for 26 times sales and 89 times free cash flow. For comparison, Alphabet trades for six times sales and 24 times free cash flow. Admittedly, this valuation isn't cheap, but it reflects how upbeat investors are about CrowdStrike's prospects.

CrowdStrike's stock may experience greater volatility than Alphabet's, but the upside is higher. If you're willing to hold onto CrowdStrike for a long-term period (three to five years), then I'm confident the stock will outperform the market due to its vast potential.

Both stocks are great places to put capital with the market off its high -- just don't expect an overnight recovery.