A skier wears a GoPro camera on his helmet as he rides down the slopes in the ski resort of Meribel. Thomson Reuters GoPro's stock surged after cost-cutting efforts helped the company post second-quarter results that beat analyst estimates. The maker of wearable cameras also raised guidance for the third quarter.

Second-quarter sales totaled $296.5 million, up 34% from the previous year, while the adjusted loss for the period was $0.09 per share, beating analyst estimates of a $0.25 per share deficit. GoPro also said third-quarter revenue will be between $290 million and $310 million, above the consensus forecast of $277.8 million.

"GoPro is building momentum," founder and CEO Nicholas Woodman said in a statement. "Strong demand combined with our cost management and margin initiatives contributed to GoPro's EBITDA positive performance in the second quarter."

The spike is welcome news for GoPro investors, who have seen the stock trade sideways for the past four months following a 58% decline from a nine-month high reached in September 2016.

Following the second-quarter earnings news, shares of GoPro spiked 13% to $9.35 a share as of 4:23 pm ET.