The court ruled that only six lines of the 24-line poem by German comedian Jan Boehmermann could be recited, offering the Turkish leader a partial legal victory.
The poem accused Erdogan of bestiality and paedophilia and has caused a storm in Germany over freedom of speech.
Chancellor Angela Merkel has come in for criticism after she authorised possible criminal proceedings against Boehmermann.
Any prosecution of the comedian would be launched under the rarely enforced section 103 of Germany's criminal code -- insulting organs or representatives of foreign states -- which carries up to three years in prison
Also Read
Boehmermann's own recital of his so-called "Defamatory Poem" on national television in March sparked a diplomatic firestorm after he admitted the work flouted Germany's legal limits to free speech and was intended as a provocation.
Merkel then authorised criminal proceedings against the comedian after Turkey requested he be prosecuted under the lese majeste law, a move which saw some of the chancellor's critics accuse her of kowtowing to Erdogan.