Undated (AP) _ Knight-Ridder Inc. reported a 39 percent decline in its first-quarter profit on Thursday, blaming poor advertising revenue due to the recession and Gulf War for its ''toughest quarter in memory.''

It was the latest in a series of weak earnings reports from media companies for the first three months of 1991. The industry has been hurt by ad spending cutbacks, commercial preemptions and higher newsgathering and distribution costs.

The media and entertainment company Viacom Inc., meanwhile, said its loss for the first quarter narrowed from a year ago as its earnings from operations rose 42 percent. Knight-Ridder Inc.

The Miami-based newspaper and information services giant earned $15.8 million, or 32 cents a share, in the quarter ended March 31, compared to $25.8 million, or 50 cents a share, in the same quarter last year.

Revenue fell 2.7 percent to $540.1 million from $554.9 million a year ago.

A 4.4 percent decline in overall newspaper revenue to $456 million is the only first-quarter drop since Knight-Ridder was formed in a merger in 1974, said Robert Singleton, chief financial officer.

That included an 8.4 percent decline in newspaper advertising revenue to $340.4 million and an 8.8 percent rise in circulation revenue to $106.6 million.

Revenue from business information services rose to $84.1 million from $77.8 million a year ago.

Prospects for the rest of the year are guarded, but Singleton was optimistic that Knight-Ridder will benefit when the economy rebounds.

''We have a chance of a flat to slightly up year, although the second quarter is currently projected to be flat to down slightly,'' he said.

Knight-Ridder publishes 29 daily newspapers, owns electronic retrieval, news, graphics and photo services as well as cable television outlets and newsprint manufacturing. Viacom Inc.

New York-based Viacom said it lost $3.7 million, or 3 cents a share, in the three months ended March 31 in contrast to a loss of $17.1 million, or 16 cents a share, a year ago.

Revenue edged up 3.6 percent to $407.2 million from $393.2 million.

The company said earnings from operations at its cable network division, which includes the MTV Networks and the pay-TV network Showtime, more than doubled to $39 million, while earnings from operations at its cable TV systems rose 66 percent to $25 million.

Entertainment segment earnings from operations rose 5 percent to $28 million. Earnings from operations in broadcasting fell 69 percent to $2 million due to softness in the ad market and recent radio station acquisition costs.

Viacom is 84 percent owned by National Amusements Inc., a closely-held company controlled by Sumner Redstone with 675 movie screens in 14 states and England.