President Lula has pulled of a surprise win, but he will face a hostile Congress and a polarised country.