A police officer and a courthouse staff member died in the attack, the agency said. Nine people were hospitalized with injuries, said Turkish Prime Minister Binali Yildirim.
Police killed two assailants, according to Izmir Gov. Erol Ayyildiz, who blamed the militant Kurdistan Worker's Party or PKK, for the attack.
So far, there has been no claim of responsibility for the attack.
On Thursday, police had stopped a suspicious vehicle at a checkpoint in front of the courthouse, which led to an armed clash between attackers and security forces, Ayyildiz said. During the clash, the attackers "detonated a car bomb as they tried to escape," he told reporters.
The attackers were armed with Kalashnikov rifles and grenades, Ayyildiz said.
Fethi Sekin, a 43-year-old police officer who had worked at the Izmir courthouse for nine years, noticed the attackers and prevented their car from reaching the entry, the state news agency reported.
He pulled his weapon and chased the attackers as they escaped from the vehicle. He killed one of the attackers, but died during the clash, according to Anadolu.
Turkish officials praised the police for their quick action.
"Our brave police prevented a disaster," Yildirim said.
Turkish President Recep Tayyip Erdogan tweeted about the two victims saying that he wished "mercy from Allah to the martyr police officer that prevented a major disaster and the crew member that lost his life."
Officials: Larger attack may have been planned
Turkey's Deputy Prime Minister Veysi Kaynak told reporters that weapons found after the explosion suggested a larger attack had been planned.
"If you look at the preparation, ammunition and guns, you understand that they were targeting a big destruction but it did not happen."
He credited the "well trained" police and theorized that the PKK or ISIS could have been responsible. At the scene, police defused a "suspicious car" believed to belong to the attackers in a controlled explosion, according to Anadolu.
Who were the attackers?
In the aftermath of the attack, Anadolu initially reported two suspected attackers were killed and a third was at large, but it's not clear if there is another suspect.
"There might be or there might not be but because of the possibility we are looking for him, and if there is one, he will be caught," Ayyildiz told reporters.
Police detained two people related to the Izmir attack, according to Anadolu. It was unclear if either is the potential suspect at large.
Amid a spate of attacks in Turkey, Erdogan posted on Twitter: "We will never give in and let terror fear our people, intimidate the country and polarize our society."
The US Embassy in Turkey condemned the attack and vowed to stand with the Turkish people in fighting terror. It tweeted a message that translates to "sorry for your loss."
Izmir, a busy port on the Aegean Sea, is Turkey's third-largest city, home to more than 2 million people.
Turkey is still reeling from the New Year's attack on an Istanbul nightclub that left 39 people dead.
According to Anadolu, at least 69 others were hurt in the shooting rampage. The gunman remains at large.
Police have detained 34 suspects, as well as others picked up in raids Thursday, the news agency reported.
ISIS claimed responsibility for the attack in a statement posted to Twitter, but CNN cannot independently verify the claim. The terror group boasted of carrying out the first major terrorist attack of 2017.
Earlier this week, Interior Minister Suleyman Soylu told lawmakers that Turkish security forces had prevented 339 major terror incidents in 2016, 80 of which came in the final three months of the year.
In his speech to Parliament, Soylu cited attacks launched by Daesh, the Arabic term for ISIS, and PKK.
PKK, which is branded a terror group by Turkey, US and EU, has sought an independent state for the Kurdish minority.
Anadolu quoted Soylu
as saying that "313 of the incidents were planned by PKK, 22 by Daesh and four by radical leftist groups."