Australia, a staunch ally of the United States and its battle against Islamic militants in Iraq and Syria, has been on heightened alert for attacks by home-grown radicals since last year.
The teenager was shot dead by police on Friday afternoon after he gunned down, at close range, a police employee leaving the headquarters of the New South Wales Police, police and witnesses said.
Police said they had identified the gunman as coming from an Iraqi-Kurdish background, and having been born in Iran.
The discovery of the boy's actions sparked a massive police operation in Melbourne that led to the arrest of five teenagers there who were planning an Islamic State-inspired attack, authorities said.
Prime Minister Malcolm Turnbull urged Australians not to vilify the Muslim community.
"This appears to have been an act of politically motivated violence, so, at this stage, it appears to have been an act of terrorism," Turnbull told reporters in Melbourne.
"We must not vilify or blame the entire Muslim community for the actions of what is, in truth, a very, very small percentage of violent extremist individuals."
Security authorities estimate at least 70 Australians have joined militant forces in the Middle East with another 100 or more Australian-based facilitators and supporters.