Donald Trump views a photo of himself on the cover of The New York Times during an RNC goodbye reception at the Westin Hotel in Cleveland, on Friday, July 22, 2016.

The higher level of news flow during the Trump administration is benefiting the New York Times Co.'s subscriber growth, according to J.P. Morgan.

The firm raised its rating to overweight from neutral for the media company's shares, predicting strong profit growth over the next two years.

"NYT has well surpassed initial expectations for subscriber growth as digital sub additions have remained elevated following the 'Trump Bump' in Q3'16," analyst Alexia Quadrani wrote in a note to clients Monday. "Near-term, we expect digital-only sub growth to continue to be supported by the stronger news cycle which is a clear benefit to circulation at NYT. While the stock has appreciated on these better sub trends, we believe ongoing acceleration in earnings growth should drive further upside from current levels."

The company's stock rose 5.6 percent Monday.

Quadrani increased her price target for New York Times shares to $27 from $25, representing 22 percent upside to Friday's close.

The analyst said digital revenue now represents nearly 20 percent of the company's sales. She said digital sales grew 46 percent year over year in New York Times' fiscal 2017, which was faster than Google's 23 percent and nearly matched Facebook's 47 percent.

"We continue to see opportunity for further upside as the company migrates from a declining print business focused on cost cutting toward a growth company with a substantial digital presence," she wrote.

Quadrani predicts the company will generate earnings-per-share growth of more than 20 percent each year in 2019 and 2020.

New York Times shares are outperforming the market this year with its stock up 20 percent in 2018 through Friday, compared with the S&P 500's roughly flat return.