The House on Wednesday approved a bipartisan bill that ensures lower interest rates on loans for students heading to college this fall.

Members of the House voted 392 to 31 to lower rates for undergraduates taking out government loans this school year to 3.86% -- cheaper than the 6.8% interest rate that kicked in on July 1. The new rates would be retroactive and apply to loans taken out after July 1.

The bill, which passed the Senate last week, will now go to the President Obama's desk to be signed into law.

It has provisions for rates to go higher in coming years.

As House members debated the bill, many Republicans took credit for the deal. They noted that the Senate version wasn't much different from their own student loan bill, which linked rates to the bond markets.

"My colleagues and I have been fighting for months for a long-term market-based solution that will serve students and taxpayers, and the legislation before us today will do just that," said Minnesota Republican John Kline, who runs the House education panel.

Related: Student loan horror stories

The new rule doesn't apply to loans that students get from private lenders. It only affects Stafford loans, which are made by the U.S. government to help finance a college education.

On July 1, the interest rate on subsidized Stafford loans doubled from 3.4% to 6.8%, affecting 7.4 million students. The subsidized loans are based on financial need and account for about 26% of all federal student loans, according to the Congressional Budget Office.

Unsubsidized loans and graduate loans were already paying 6.8% interest rates.

The latest bill helps all students, with the basic principle being that it ties student loan rates to the bond markets.

This fall, undergraduate students will pay an interest rate of 3.86% on their loans. It is comprised of the yield on the 10-year U.S. Treasury note on June 1, plus an additional 2.05%. Graduate students will have to pay 5.41% on loans this fall, or 3.6% over the 10-year Treasury.

Related: Bill helps college students now, but future students to see rate hikes

If rates on Treasury notes rise, so would student loan rates under the new deal.

However, the bill makes provisions to protect students if bond yields were to spike. Loans for undergraduates will be capped at 8.25% and for graduates at 9.5%.

Over 10 years, the interest that government collects on student loans is expected to raise $715 million. It will go toward reducing deficits.

The Obama administration has been pushing for the deal, even though left-leaning Democrats opposed the bill for hiking rates in coming years.

Student loan debt has skyrocketed in recent years, as have delinquencies, making it a pressing political and financial issue for millions of Americans. Many students graduate from college deep in debt and without jobs. It is second only to mortgages as the largest debt that consumers carry. In 2011, students on average owed nearly $27,000 in loans.

-- CNN's Ted Barrett and Deirdre Walsh contributed to this piece.