West Ham midfielder Lucas Paqueta put Brazil ahead in the 11th minute, before Habib Diallo equalised for Senegal.
An own goal from Marquinhos early in the second half gave Senegal the lead with Mane extending their advantage after 57 minutes.
Marquinhos scored at the right end to pull one back for Brazil but Mane got his second goal with a late penalty.
The match was held at Estadio Jose Alvalade, home of Sporting Lisbon, with nine England-based players in the starting XIs.
As well as Paqueta, Brazil’s team at the beginning of the match included Manchester City goalkeeper Ederson, Newcastle midfielders Joelinton and Bruno Guimaraes and Tottenham forward Richarlison.
Meanwhile, Senegal’s side included Nottingham Forest defender Moussa Niakhate, Chelsea centre-back Kalidou Koulibaly, Leicester midfielder Nampalys Mendy and Watford forward Ismaila Sarr.