The newspaper publisher's shares rose as much as 12 percent on Wednesday.

The company added 308,000 net digital news subscriptions in the quarter, topping the previous quarter's tally of 276,000.

The Times has been building up on the online readership it gained during the U.S. presidential election by marketing unbiased reporting in the face of President Donald Trump's combative view of traditional news media.

Trump has repeatedly criticized the press, including the Times, calling it "fake news" and "the enemy of the American People!"

In response, the New York Times launched its "Truth" campaign, including its first TV ad in seven years, urging readers to sign up in order to support its fair and accurate reporting.

"Even the President of the United States was kind enough to draw attention to it," Chief Executive Mark Thompson said on a post-earnings call with analysts on Wednesday, referring to the campaign.

New York Times' paid digital-only subscriptions stood at about 2.2 million at the end of the first quarter of 2017, soaring more than 60 percent from a year earlier, and up 16 percent from the end of the preceding quarter.

Thompson called the first quarter the "single best quarter for subscriber growth" in the company's history.

Total revenue rose to 5.1 percent to $398.8 million, beating the average analyst estimate of $381.96 million, according to Thomson Reuters I/B/E/S.

"Helped by tailwinds from the political cycle, digital has been increasingly offsetting the secular declines at the legacy print business," Barclays analysts wrote in a client note.

Digital advertising revenue, which now makes up about 38 pct of total ad revenue, rose 18.9 percent to $49.7 million.

Print advertising revenue continued to fall, down 17.9 percent to $80.4 million in the first quarter.

The Times has been investing heavily to boost its digital offerings that focus on mobile devices and brand marketing as well as other services to lure readers.

Operating costs rose 4.5 percent to $367.4 million in the first quarter. It has taken up cost-cutting measures, including layoffs and shutting some Paris operations.

Net income attributable to the company was $13.2 million or 8 cents per share, compared with a loss of $8.3 million or 5 cents per share, a year earlier.

Excluding one-time items, the company earned 11 cents per share, beating the estimate of 7 cents.

(Reporting by Laharee Chatterjee in Bengaluru; Editing by Sai Sachin Ravikumar)

By Laharee Chatterjee