Brazilian President Luiz Inacio Lula da Silva won an unprecedented fourth term on Sunday, the country's electoral court said, in a shock result that defied polls, precedent and global anti-incumbent sentiment to put the brakes on a wave of right-wing election victories across Latin America.