NEW YORK — The New York Times Co. said on Thursday that it had net income of $20.1 million for the second quarter, helped by a jump in paid digital subscriptions that largely offset lower advertising revenue.

The profit reversed a year-ago loss that stemmed from costs related to the sales of businesses. The results were in line with analysts' expectations, but the company warned that it expects continued "volatility" in advertising revenue for the current quarter.

Times Co. shares rose as much as 3 percent in morning trading, before falling to $11.77 to close down 3 percent for the day. The company's stock has climbed nearly 40 percent percent since the beginning of 2013, compared with the Standard & Poor's 500 Index's 20 percent.

"The increase in operating profit reflects the ongoing evolution of our digital subscription initiatives on the circulation side, the moderation of revenue declines on the advertising side and the continued focus on managing costs," Times Co. President and CEO Mark Thompson, who joined the company in November, said in a statement.

The New York-based company, which operates The Boston Globe and International Herald Tribune in addition to its flagship paper, said net income of $20.1 million amounted to 13 cents per share. That compared with a loss of $87.6 million, or 58 cents per share, a year ago. The 2012 period's results included $125.7 million in losses from discontinued operations related to the sales of the company's Regional Media Group and About Group.

The recent quarter's results included a charge of $1.6 million, or 1 cent per share, related to severance costs. Excluding that, the company earned an adjusted 14 cents per share. Analysts surveyed by FactSet expected 13 cents per share.

Excluding the losses related to Regional Media Group and About Group, along with $1.8 million, or 1 cent per share, in severance costs and a gain of $22 million, or 15 cents per share, related to the sale of the company's remaining stake in Fenway Sports Group, Times Co. earned an adjusted 11 cents per share for the year-ago period.

Revenue slipped about 1 percent to $485.4 million from $489.8 million.

Like other newspaper companies, Times Co. has faced declines in print advertising and subscription revenue. The company has tried to offset those drops by increasing the number of digital subscribers. Times Co. said digital subscriptions at the end of the recent quarter totaled 738,000, representing a nearly 40 percent increase from the end of the same quarter a year ago. Revenue from digital subscriptions rose 44 percent to $38.3 million.

While still a small fraction of the overall total, the jump in digital subscription revenue helped boost overall circulation revenue 5 percent over the second quarter of 2012 to $245.1 million. That amount includes revenue from both print and digital sales.

Circulation revenue also was helped by increases in print circulation prices at the company's flagship paper and The Boston Globe.

For the current quarter, Times Co. said it expects total circulation revenue to increase in the "low- to mid-single digits."

Total advertising revenue fell 6 percent to $207.5 million, as print advertising revenue dropped 7 percent and digital advertising revenue fell 3 percent.

The company noted that advertising revenue improved from first-quarter levels but also warned that it expects advertising revenue to remain volatile in the third quarter.