The striped long-sleeved top featured a golden six-pointed star stitched onto the upper left hand side with the word Sheriff printed in light lettering.
It was available to buy online via Zara's website.
Twitter users wrote "What were the designers thinking?" alongside links to the shirt, which now directs visitors to a message reading: "We are sorry. The item you are looking for is no longer available."
Dimi Reider, an Israeli journalist and associate fellow at the European Council on Foreign Relations blogged: "A striped pyjama with a yellow star for your child. It's a SHERIFF shirt for your three year olds. Obviously. What else could it be?"
A spokesman said: "The item in question has now been removed from all Zara stores and Zara.com.
"The garment was inspired by the classic Western films but we now recognise that the design could be seen as insensitive and apologise sincerely for any offence caused to our customers."
In September 2007 the Spanish-owned retailer was forced to withdraw a line of handbags emblazoned with swastikas from its stores in Britain.