Houston-based Marathon Oil Co. agreed to invest $177 million in extensive compliance measures—a condition of a settlement reached Thursday with the Environmental Protection Agency and the Justice Department.

Much of that commitment will be expended by the end of this year, according to a joint statement of the EPA and the U.S. Department of Justice.