In a statement, the US mission in Ankara advised Americans to stay away from the affected area and other high-frequented places in Turkey.
A policeman at a checkpoint guarding a courthouse in Izmir was trying to stop a car when it exploded, Governor Erol Ayyildiz told the press, saying an exchange of fire erupted after the militants sought to escape.
The policeman and a female usher from the courthouse lost their lives in the gunfight, while two attackers were killed and the third one managed to escape, the governor said.
He put the number of the wounded at seven, three police plus four civilians.
Turkish Prime Minister Binali Yildirim issued a statement asking for unity and praising the dead police officer's effort in preventing more bloodshed.
A second explosive-laden vehicle was defused at the scene, while two automatic rifles, one rocket propelled grenade launcher and eight hand grenades were seized, Ayyildiz said.
The governor, citing initial reports, blamed the Kurdistan Workers' Party outlawed by Ankara for the attack.
Two suspects have been detained over the assault, the state-run Anadolu Agency said.