The government's once comfortable margin was diluted in the 269-244 vote, with 53 abstentions, but still allows Valls to carry out reforms aimed at lifting France out of its economic crisis.
President Francois Hollande's popularity has plunged over failure to cure the nation's high unemployment rate, zero growth and over sized deficit. He had promised to create jobs for the French when he took office in 2012 after defeating the conservative incumbent, Nicolas Sarkozy.
Of the 53 abstentions, 31 of them were Socialists, who hold 289 seats in the 577-seat National Assembly, the lower house.
Valls was backed by 309 lawmakers in an April vote of confidence when he took office.
Also Read
"We will continue this route ... Until the end of the term," Valls said after the voting. "This is what the French expect, that we roll up our sleeves and be up to the challenges."
"To reform is not to break, to reform is not to regress ... To reform is to affirm our priorities, while refusing austerity," Valls said.
Valls called for the confidence vote after expelling two dissident ministers from the Cabinet this summer, with another leaving voluntarily.
They were the most visible among a group of Socialists critical of government policy whose vote or decision to abstain could be critical to the size of the majority given to Valls and his capacity to carry out reforms.
Hollande was lately bashed in a book by his ex-companion and a newly-appointed Socialist minister lasted but nine days on the job after revelations he hadn't been paying taxes and other bills on time.