WASHINGTON — The Environmental Protection Agency and the Department of Justice announced Tuesday that Exxon Mobil will pay $2.5 million in fines for flaring gases at eight plants along the Gulf Coast. Agency officials said the announcement was evidence of the Trump administration’s commitment to enforcing the nation’s environmental laws.

Exxon will spend about $300 million as part of the settlement to install gas recovery and other new monitoring and pollution control technologies at the petrochemical plants in Louisiana and Texas, according to agency officials.

The agencies also settled a second case involving air pollution violations with PDC Energy, a Colorado oil and gas company whose storage tanks were found to be leaking smog-forming compounds. The company also was fined $2.5 million, which will be shared by Colorado and the federal government.

“We will be enforcing environmental laws in this administration and that’s not just my message, it’s the message straight from the top,” said Patrick Traylor, the E.P.A. deputy assistant administrator for enforcement. The agency, Mr. Traylor said, is “emphasizing the rule of law in this administration, specifically at E.P.A.”