Chelsea midfielder Oscar set the South Americans on their way to an easy win in Malmo with two goals in a five-minute spell midway through the first half against opponents who are coached by former Brazil captain Zico.
Real Madrid's Kaka, who last played for his country at the 2010 World Cup, added the third early in the second half before Hulk, Neymar and Lucas shared three more goals as Brazil's incisive passing sliced through the Iraq defence.
Iraq goalkeeper Noor Sabri prevented Brazil from inflicting further embarrassment with an inspired performance.
Iraq, unable to play at home for security reasons, face Australia in a World Cup qualifier in neutral Doha on Tuesday and Zico was unhappy at the timing and venue of the Brazil match.
"We left Qatar where it was 35 Celsius, travelled for 10 hours to a place where it's five Celsius and we have to go back again afterwards," he told Brazilian media before the match. "It wasn't the right moment."
"I wanted to play Wales and they gave me Brazil."
Brazil broke the deadlock in the 22nd minute when Neymar carried the ball forward and set up Oscar, who slotted it past the oncoming Sabri. Five minutes later, Kaka pulled the ball back from the byline and Oscar turned it in from close range for the second.
Sabri then denied David Luiz, Neymar and Kaka in quick succession and Paulinho headed against the underside of the crossbar, leaving Iraq grateful to be only two goals behind at half-time.
Three minutes after the break, Kaka burst down the left, slipped past a defender and fired the ball into the roof of the net from a narrow angle.
Sabri made two more saves before Hulk scored the fourth in the 55th minute, cutting inside his marker and firing a low shot into the bottom far corner.
Neymar scored the fifth with a curling shot in the 75th minute and then played a one-two with Lucas who completed the rout.
Five-times world champions Brazil face Japan in another friendly on Tuesday in the Polish city of Wroclaw.
Iran are fourth out of five teams in Asian qualifying Group B after taking two points from three games.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.