The New York Times has attributed some of its readership gains to renewed interest in its aggressive coverage of the Trump administration

The New York Times said Wednesday it added more than 300,000 digital subscribers in the first quarter, helping the media group swing to profit.

Net profit for the prestigious US newspaper group was $13.2 million, compared with a loss of $8.3 million in the same period a year ago.

Total revenues rose 5.1 percent to $399 million, led by gains in digital subscriptions and online advertising.

"These results show the current strength and future potential of our digital strategy not just to reach a large audience, but also to deliver substantial revenue," said Mark Thompson, president and of the New York Times Company.

"We added an astonishing 308,000 net digital news subscriptions, making the first quarter the single best quarter for subscriber growth in our history."

Overall circulation revenue rose 11 percent from a year ago to $242 million. Of that $76 million came from digital-only subscriptions, amounting to a 40 percent jump from a year ago.

The number of digital-only subscriptions topped 2.2 million at the end of the quarter, a 62 percent jump from a year ago.

The Times—which has been a target of President Donald Trump, who frequently calls it a "failing" newspaper—has attributed some of its readership gains to renewed interest in its aggressive coverage of the new administration.

Digital advertising revenue was $49.7 million, a rise of 19 percent from a year ago, and accounted for 38.2 percent of total ad revenues.

But the gains failed to fully offset declines in print advertising.

Thompson said the latest figures were "a vindication of our decision to pivot towards mobile, branded content and a broader suite of marketing services, and to focus on innovation."

The New York daily has been facing the familiar problems of major newspapers—shifting to the less profitable online format as print readership declines.

The Times earlier this year unveiled a new strategic plan that will likely reduce its newsroom staff of around 1,300, while making investments in key areas including "visual journalism" and boosting coverage of the Trump administration.

The Times has moved to get more readers globally with a Spanish-language edition and an expanded office in Australia, and has launched a daily edition for the Snapchat Discover platform.