The New York Times ( NYT) surprised Wall Street with a second-quarter profit Thursday, though the company's core problem -- declining ad sales for print media in general -- continued to accelerate.

In fact, the Times said total ad sales fell by 30% from a year ago, worse than the 27% contraction registered by the publisher of record last quarter -- and, indeed, a more severe drop than in any period in recent memory at the company.

Still, investors appeared to seize on the positive earnings surprise and on one phrase in the report, delivered by Times CEO Janet Robinson. Though ad revenues "decreased across all major categories," she said in a prepared statement, "the rate of decline lessened throughout the quarter."

And that was it. Investors, especially on a stridently upward day across the equities markets, bid up Times shares by 3.5% to $6.85, on heavier than average volume.

Stripping out charges and one-time gains, the Times posted adjusted per-share earnings of 8 cents a share, well above analysts' expectations of a 4-cent loss.

The Times attributed the better-than-expected figure to cost cutting. Operating expenses fell 20% in the second quarter compared with a year ago, it said. Some of those savings came from extracting concessions from the unions at the Boston Globe, where the Times recently settled a labor dispute after threatening to shut the paper down.

The Times gave no indication of its plans for the Globe, which is reportedly for sale. It did say that it wants to sell off its stake in the Boston Red Sox by at some point this year.

Including items (amortization, depreciation and severance payments to laid off workers, etc.) in both the just-ended and year-ago quarters, the company had a profit of just $39 million, or 27 cents a share, up from $21 million, or 15 cents, a year ago. (The latest period was helped by a $37 million tax break.)

Total revenue fell 21% to $585 million from $742 million.

If you liked this article you might like

Tesla Shorts Beware; Traditional Media Makes a Comeback, -ICYMI

Rolling Stone Stake Could Fetch as Much as $80 Million

Can an iTunes for News Succeed? Chartbeat Founder Thinks So

Tronc Has Another Makeover Project With Daily News

Judge Tosses Sarah Palin's Defamation Lawsuit Against the New York Times