A suicide bomber has killed at least 21 people in an attack on Shia pilgrims north of Baghdad, officials and a survivor of the blast have said.

Monday’s attack in the Taji area, which targeted a tent serving refreshments to pilgrims, also wounded at least 35 people.

Pilgrims from Iraq and abroad are making their way to Samarra, north of Baghdad, to commemorate the death of Hassan al-Askari, one of the 12 revered Shia imams, who is buried in the city.

"We were distributing food, fruit and tea to the pilgrims who were walking to Samarra, and a suicide [bomber] blew himself up," Sajjad, 25, said at a Baghdad hospital where his brother Mustafa was being treated for shrapnel wounds.

There was no immediate claim of responsibility for the attack, but suicide bombings are carried mostly by Sunni rebels in Iraq, including those from the Islamic State in Iraq and the Levant (ISIL) group.

ISIL spearheaded a June offensive that overran large parts of the country, and Iraqi security forces, Kurdish, Shia and Sunni fighters are currently battling to push ISIL fighters back.

A US-led coalition is carrying out air strikes against ISIL targets and also providing training to Iraqi forces.