Irfan Adil Uncu, the chief judge in the case, cleared Elif Shafak because of lack of evidence shortly after the trial began.
Shafak is one of a number of writers, journalists and academics pursued by nationalist prosecutors under article 301 of Turkey's penal code for allegedly insulting 'Turkishness'.
She had faced up to three years in prison if convicted for comments made by fictional characters on the massacre of Armenians under the Ottoman Empire during World War One in her best-selling novel "The Bastard of Istanbul".
Turkey denies claims that 1.5 million Armenians were killed in a systematic genocide.
The EU, which Turkey hopes to join, has repeatedly urged Ankara to abolish article 301, saying it violates the principle of freedom of expression and thought.
Writers and journalists turned out in support of Shafak, who gave birth last week and did not attend the trial.
Speaking outside the court, Necmiye Alpay, a prominent Turkish literature critic, told Aljazeera: "We are here to support Elif Shafak and freedom of speech in Turkey."
The Shafak case has been compared to that of Orhan Pamuk, which took on the same symbolism in the fight for freedom of speech in Turkey earlier this year. Pamuk's case was dropped on a technicality.
Cem Erciyes, editor of arts and culture at the daily newspaper Radikal and a supporter of Shafak, told Aljazeera: "This was much better organised in terms of security. At the Pamuk case there was much more trouble. The police isolated the protestors outside the court here."
Although the police presence was high, it could not prevent a scuffle from breaking out as the nationalist lawyers who had instigated the case passed the courthouse. They were caught in a clash between nationalists and Shafak supporters outside the building.
Nationalists shouted "break the hand of the traitors" while leftists responded with shouts of "shoulder to shoulder against the fascists".
A Turkish shop keeper, who spoke to Aljazeera on the condition of anonymity, said: "I just heard the decision and I am very happy about it. Why should she be prosecuted for fictional characters? We are allowed to criticise the US and the UK, why can we not criticise Turkey?"
Shafak has faced criticism from some Turkish intellectuals for initially writing the book in English. She painstakingly translated it into Turkish from the original manuscript.
Alpay said: "Many Turkish intellectuals have criticised Shafak for writing in English not Turkish saying that she has not been true to her own language."
Turkey entered EU accession talks last October but has come up against criticism for its human rights record.
Erciyes said: "Turkey is doing much better as a country and of course we are very European in our ways, but there is much of Turkey that is not ready to accept the road towards Europe.
"We have seen a rise in nationalism and with the level of education still quite low when you look at the Turkey beyond the big cities, it is not difficult to understand why there is a part of the country that is not ready for this change."