The motion was put forward to show "solidarity" with the families of the Hillsborough football stadium disaster.
It also called on the council to support the campaign group Total Eclipse of the S*n, which wants all shops to boycott the newspaper.
A spokesperson for The Sun described the move as "extreme censorship".
"We are astonished that in Derry - a city that has prided itself on its association with civil liberties and free speech - some elected politicians think it's appropriate to push such extreme censorship on its citizens and retailers," it said.
The vote was proposed by independent councillor Paul Gallagher and supported by 27 SDLP, Sinn FÃ©in and independent members.
One unionist representative voted against, whilst seven more unionists abstained.
"This newspaper has produced lies, after lies, after lies," said Mr Gallagher.
"In the aftermath of the Hillsborough inquiry, we wanted to show solidarity with the families, just as they showed solidarity with the families of Bloody Sunday.
"People are still free to make a choice, we are requesting not telling."
Liverpool councillors unanimously backed a similar motion to stop selling The Sun earlier this week.
The newspaper has been widely boycotted in the city because of its accusations following the Hillsborough disaster.
All 96 fans who died as a result of a crush at Hillsborough were unlawfully killed, inquests concluded in April.
Mr Gallagher agreed with those sentiments but also cited local examples of "terrible hurt" he said The Sun caused.
In 2006, The Irish Sun's front page said: "Husband mows down vigil gran".
The article referred to Nellie Doherty, 78, who died when a vehicle shunted her husband's car which then hit her as she prayed by the road for a friend killed in another accident.
The newspaper later printed an apology, but Nellie Doherty's sister, Margaret McDaid, said at the time that it was not enough.
Derry City and Strabane District Council has passed a motion asking local newsagents to stop selling The Sun.