The credit rating agency's agreement represents one of the government's key efforts to hold accountable market players deemed responsible for contributing to the worst financial crisis since the Great Depression. The settlement announced Tuesday came after months of negotiations.

The Justice Department filed civil fraud charges against S&P two years ago this week. It accused the company of failing to warn investors that the housing market was collapsing in 2006 because doing so would hurt its ratings business.

"While this strategy may have helped S&P avoid disappointing its clients, it did major harm to the larger economy, contributing to the worst financial crisis since the Great Depression," Attorney General Eric Holder said in a statement on Tuesday.

The Justice Department had demanded $5 billion in penalties from S&P when it sued the company in February 2013. The payment of about $1.38 billion to settle the case is less than S&P's revenue in 2013 of $2.27 billion.

The three big rating agencies — S&P, Moody's Investors Service and Fitch Ratings — have been blamed for helping fuel the 2008 crisis by giving high ratings to high-risk mortgage securities. The high ratings made it possible for banks to sell trillions of dollars' worth of those securities. Some investors, such as pension funds, can only buy securities that carry high credit ratings.

Experts say the Justice Department's lawsuit against S&P could serve as a template for action against Fitch and Moody's.

S&P disputed the government's allegations when the federal suit was filed, calling the legal action "meritless" and the claims "simply not true." The company insisted its ratings were based on a good-faith assessment of the performance of home mortgages during a time of market turmoil.

Last month, S&P agreed to pay the federal government, New York state and Massachusetts more than $77 million to settle separate charges by the Securities and Exchange Commission related to its ratings of high-risk mortgage securities after the crisis. The SEC had accused S&P of fraudulent misconduct, saying the company loosened standards to drum up business in 2011 and 2012.

S&P neither admitted nor denied the charges in the settlement.

S&P also announced Tuesday that it will pay $125 million in a separate settlement with the California Public Employees' Retirement System to resolve its claims against the company regarding ratings on three structured investment vehicles. The settlement is not subject to judicial approval.