Brazil were stunned as Nigeria ran riot with three goals in the first five minutes, with Victor Osimhen scoring his eighth goal in five games, while Kingsley Michael and Udochukwu Anumudu also got on the scoresheet.
Four-time champions Nigeria sent Brazil packing as they secured passage to the final four.
Mali's resolute defence continued in their 1-0 victory over Croatia, extending their run of cleansheets to almost five hours. Sekou Koita's first-half effort was enough to see off the Europeans, despite a booking for captain Abdoul Dante meaning their leader and defensive organiser will miss the historic semi-final.