President Luiz Inacio Lula da Silva's victory was eked out in the 11th-hour after voters from his heartland rallied to the rescue.