Lula won Brazil’s presidential election with 51.8% of valid votes. His victory defeated a rival who had pledged to remove environmental protections in the Amazon.