Brazil's Congress has approved a bill that designates all royalties from newly discovered oil fields to education and healthcare.
The bill, which had already been approved by Senate, was passed by the lower house on Wednesday.
The move is one of several reforms proposed by the president in the wake of widespread protests sparked by a rise in transport costs.
Once signed by the president, the bill is due to come into effect next year.
According to the resolution, 75% of drilling royalties the Brazilian government receives from oilfields in the so-called "pre-salt" layer are to be invested in education and 25% on health.
The pre-salt area is so called because the oil and gas lies beneath several thousand metres of water, rock and salt off the Brazilian coast.
Demonstrations that rocked Brazil in June were triggered by transport fare rises, but quickly encompassed other issues including the cost of staging the 2014 World Cup and corruption.
The protests often ended in fighting between police and protesters.
The unrest prompted President Rousseff to present a package of investment and reforms in public services.
Demonstrations have grown smaller since June, but several took place in Brazilian cities on Wednesday including in Rio de Janeiro and in Sao Paulo.
In Rio, about 200 protesters tried to reach Governor Sergio Cabral's Guanabara Palace, demanding his impeachment and political reform.
The area was blocked off by police and officers used tear gas and rubber bullets after protesters tried to break through their lines.
Another protest was staged in Rio's Rocinha shanty town to mark one month since a bricklayer went missing after being held for questioning by police.
Last weekend, tens of thousands of workers across Brazil joined a day of strikes called by trade unions. They ended in clashes between police and protesters.