While a company's soaring stock price can sometimes be a good sign that the stock is becoming overvalued, this isn't always the case. There are times when a rising stock price is an excellent indicator of a winning business that investors have previously underestimated.

This may be the situation for Salesforce.com (NYSE:CRM) and Alphabet (NASDAQ:GOOGL) (NASDAQ:GOOG). Year to date, both of these stocks have performed exceptionally well. Salesforce and Google are up about 32% and 19%, respectively. During this same period, the S&P 500 increased just 10%. Despite these stocks' recent bullish runs, both look like solid bets for the long haul.

Hand drawing five stars in a row

Image source: Getty Images.

SaaS at its best

If you're looking for a total pure play in the profitable and fast-growing software-as-a-service (SaaS) market, look no further than Salesforce.com. Salesforce.com offers a range of SaaS products for the enterprise market, covering all key aspects of customer relationship management, with powerful offerings that aim to simultaneously improve clients' effectiveness and efficiency while also reducing their operating costs.

Despite Salesforce.com's already significant trailing-12-month revenue of about $9 billion, the company continues to grow rapidly today. In Salesforce.com's fiscal first quarter of 2018, revenue and operating cash flow were up 25% and 17% year over year, respectively. And for the full fiscal year, management expects revenue to rise a meaningful 22% to 23% year over year.

Of course, investors will need to pay a significant premium to buy into a fast-growing market leader in the hot SaaS segment. The stock has a price-to-sales ratio of 7.2, higher than an industry average price-to-sales ratio of 5.6, but Salesforce.com is worth the price.

Tech's best near-monopoly?

If there's one company in tech that seems to be so far ahead of competition that it's unlikely others will ever catch up, it's Alphabet. Last year, Alphabet's Google boasted an estimated 75.8% share of U.S. ad search revenue, according to eMarketer. This share is expected to increase to 80.2% by 2019. The expected rise in market share is due to Alphabet's strategic positioning in the growing mobile search market, eMarketer says. 

Alphabet's continued dominance in digital search was evident in the company's recently released second-quarter report. Advertising revenue during the quarter, which accounted for 87% of total revenue, climbed 18% year over year. Management cited mobile search and YouTube as key drivers for the company's ad revenue growth during the quarter.

And as if the performance of Alphabet's core search business isn't enough to justify buying shares, Alphabet's "other" Google revenue soared 42% year over year during the quarter. This surge was driven by the Android app store, Google-branded hardware, and cloud services -- three very promising parts of Alphabet's business. The segment now accounts for a meaningful 12% of Alphabet's total revenue, up from 10% in the year-ago quarter.

Like Salesforce.com, Alphabet stock isn't cheap. It has a price-to-sales ratio of 6.7. This compares to a price-to-sales ratio of 6.3 and 3.8 for competitors Microsoft and Apple, respectively. But the sustainability of Alphabet's business model and its significant lead over competition make it worth the premium.

Sure, both stocks could see some volatility given investors' high expectations. But both companies' leadership positions and superior business models should make their stocks outperformers over the long term.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.