The idea of free textbooks for all state school students had been proposed in every annual state budget since 2016.
On Friday, in the last plenary session of the legislature, the idea became law.
In recent years the government had encouraged pupils to return textbooks to schools for reuse, but this came under criticism as many textbooks are not designed to be reused.
This year, parents complained that they had to pay for books that had been written in by other children during the school year.
Others complained that they had been made to pay for books by schools because when they returned the books at the end of the academic year, the books were in poor condition.