What happened

Shares of Dropbox (DBX -0.61%) gained 21.6% in the first six months of the year, according to data from S&P Global Market Intelligence. The stock gained ground thanks to two encouraging quarterly reports and momentum for cloud-storage services stemming from the coronavirus pandemic.

^SPX Chart

^SPX data by YCharts.

Dropbox significantly outperformed the broader market across the first half of the year, but the business also faced mounting challenges from a growing number of competitors entering the cloud file-hosting space. The company's diversification into digital workspace services appears to have been a smart move.

A cloud icon.

Image source: Getty Images.

So what

Dropbox reported results for the fourth quarter in February and posted sales and earnings that topped the market's expectations. The company grew sales 19% year over year in the period to reach $446 million, and adjusted earnings for the period came in at $0.16 per share. The average analyst targets, as polled by Refinitiv, had earnings of $0.14 per share on revenue of $443 million. The company's paying-user base of 14.3 million also topped the market's target for 14.2 million in the period.

The company delivered another promising set of numbers when it reported first-quarter results in May. Dropbox had adjusted EPS of $0.17 on revenue of $455 million (up 18% year over year), surpassing the average analyst targets for EPS of $0.14 on sales of $452.2 million. The company closed out the quarter with 14.6 million paying users, which was in line with the average analyst estimate.

Now what

Dropbox stock has continued to climb in step with momentum for the broader market early in July's trading. Shares are up roughly 5% in the month so far.

^SPX Chart

^SPX data by YCharts.

Dropbox is targeting revenue between $463 million and $466 million in the second quarter and an adjusted operating margin between 16.5% and 17.5%. The company expects full-year sales to come in between $1.88 billion and $1.9 billion and an adjusted operating margin between 17.5% and 18%. Free cash flow for the year is projected to be between $460 million and $470 million.

Dropbox trades at roughly 22.5 times this year's expected earnings and 4.9 times expected sales.