Luis Abram's 85th-minute goal gave Peru a 1-0 win and handed Brazil its first defeat since the 2018 World Cup quarterfinals against Belgium.
Brazil had gone undefeated in its last 17 matches between then and Tuesday, amassing a 13-0-4 record. Two of those victories came against Peru in the 2019 Copa America by 5-0 and 3-1 scores.
Abram's first international goal couldn't have come at a better time at the Los Angeles Memorial Coliseum.
Peru earned a free kick outside the top-right corner of the 18-yard box with minutes remaining. Yoshimar Yotun then laced a piercing kick into the goal box, and Abram headed the ball home.
Greg Beacham of the Associated Press put the night in perspective for Abram:
Brazil was without the services of Dani Alves and Thiago Silva, who rested. Neymar did not start but replaced Roberto Firmino in the 63rd minute.
Brazil outshot Peru 13-9, but both teams had three shots on goal. Brazil controlled possession for 56 percent of the match and earned six corner kicks to Peru's two.
Per Reuters (h/t ESPN), the win marked Peru's fifth victory over Brazil in 46 matches.
The match was the second of a five-friendly Brazil Global Tour that will end on Nov. 19. Brazil's next contest will take place in Kallang, Singapore, against Thailand on Oct. 11.
Peru will travel to Montevideo, Uruguay, to take on the host country in a friendly on the same date.