Facebook’s stock has had a rough time since the company went public in May 2012, but the social network’s shares have roared back over the past week.

In early trading Wednesday, shares briefly popped above the company’s initial public offering price of $38 a share for the first time since its problematic debut, which was marred by technical glitches and a deep dive in the company’s stock price.

After languishing below $30 a share for most of the summer, Facebook’s stock began a five-day drive last week after Facebook issued an upbeat earnings report. The company’s stock is up nearly 40 percent since last week.

An initial burst of investor enthusiasm Wednesday morning was followed by some selling, sending the company’s shares down about 3 percent to close at $36.80 a share.

Facebook declined to comment on its stock’s performance.

Investors appear happy that Facebook may have finally gotten a handle on two of its biggest problems: its users’ shift to mobile products and doubt that it had a solid long-term strategy for attracting advertisers.

In its latest report, Facebook showed significant improvement in its mobile strategy. The number of monthly mobile users increased 51 percent during the quarter and advertising on smaller screens comprised about $656 million of the company’s $1.6 billion in ad revenue.

That’s particularly impressive to analysts because Facebook made virtually nothing from mobile advertising last year.

Facebook has been aggressive about improving relationships with advertisers on all platforms. In June, the company said it would streamline its advertising products in response to feedback from its customers, who complained that figuring out how to reach a target audience on the site was too difficult.

There’s also building expectation that Facebook may introduce video ads on the site in the near future. The firm recently introduced the ability to film 15-
second videos through its Instagram service — a length that many analysts pointed out was ideal for advertisements.

Efforts to wring money from ads on small screens have coincided with a push to make Facebook a “mobile-first” company. It has encouraged its developers to create products that draw users tapping away on their smartphones and tablets.

This all stands in sharp contrast to Facebook a year ago, when analysts worried that the network was floundering for a way to reach its target audience. While the site still faces questions about whether it’s in a position to maintain its appeal to younger users, its latest earnings report appears to have convinced investors — for now — that the company is growing up.

(Washington Post Co. Chairman and chief executive Donald E. Graham is a member of Facebook’s board of directors.)

Related stories:

Facebook launches mobile game platform, edges near IPO price

Facebook blows the market away with 2nd-quarter gains from mobile advertising

Sign up today to receive #thecircuit, a daily roundup of the latest tech policy news from Washington and how it is shaping business, entertainment and science.