Former France U-20 international Opa Nguette put the hosts ahead on 55 minutes and Themba Zwane missed a penalty for South Africa before Percy Tau levelled after 65 minutes.
M’bodji nodded the 93rd-minute winner following a corner as the visitors once again failed to combat the aerial strength of Senegal at set pieces.
Prejuce Nakoulma scored a hat-trick as Burkina Faso trounced Cape Verde 4-0 in a match played simultaneously in Ouagadougou.
Banou Diawara completed the rout during stoppage time by nodding in a free-kick from point-blank range.
Senegal won the group and secured a place at the 32-nation finals in Russia next June and July by winning 2-0 in South Africa four days ago.
That match was a replay of a game which South Africa won 2-1 last year, but FIFA annulled when they discovered it had been “manipulated” by Ghanaian referee Joseph Lamptey.
Lamptey was banned for life after his decisions included awarding a non-existent penalty to South Africa, which they converted.
Senegal topped Group D with 14 points from home and away victories over South Africa and Cape Verde and two draws against Burkina Faso.
Burkina Faso finished second with nine points, Cape Verde third with six and 2010 World Cup hosts South Africa last with just four.
Egypt, Morocco, Nigeria and Tunisia are the other qualifiers from Africa, none of whose teams have gone beyond the quarter-finals at a World Cup.
Countries who failed to make it to Russia included reigning African champions Cameroon, and Ghana and the Ivory Coast, who qualified for the last three editions.
Would you like to place a soccer bet? Click here to get started in 3 easy steps.