Several other people have been seriously injured and a baby was among those attacked at Westfield Bondi Junction in the city's eastern suburbs.
A nearby NSW Police inspector entered the centre, catching up with the man on level five as people fleeing gave directions.
"She confronted the offender … as she continued to walk quickly behind him to catch up with him, he turned, faced her, (and) raised a knife," NSW Police assistant commissioner Tony Cooke told reporters on Saturday.
"She discharged a firearm and that person is now deceased," he said.
The man was seen on CCTV entering the centre about 3.10pm, leaving, and then returning a short time later, when he attacked nine people, Mr Cooke said.
Police believe the man acted alone but are still working to identify him, and nothing at the scene so far indicates "any motive or ideology", he added.
Details are limited as police began a lengthy investigation of a large crime scene.
"Things are very, very raw at this stage and we are in the very early stages of investigations," Mr Cooke said.
Emergency services rushed to the Bondi Junction shopping centre on reports of multiple stabbings. (Steven Saphore/AAP PHOTOS)
Prime Minister Anthony Albanese said the incident was a horrific act of indiscriminate violence and extended condolences to those grieving and injured.
But the response of emergency services and others at the scene whose first instinct was to help others illustrated the nation's humanity and heroism.
"That is what we hold onto tonight as Australians, that is confirmation of who we are. Brave, strong, and together," he said.
Australian Federal Police Commissioner Reece Kershaw said it was too early to determine if the incident was terror-related but said ASIO and other agencies were involved in briefings and the AFP was providing any required assistance.
Like all shootings involving NSW Police the investigation will be monitored by the Law Enforcement Conduct Commission.
Armed police responded to the attack on shoppers at Bondi Junction. (HANDOUT/ABC NEWS)
NSW Ambulance assistant commissioner Brent Armitage said eight people were taken to hospital.
Multiple posts on social media showed crowds of people outside the shopping centre as it was placed into lockdown.
One man told ABC: "They just said run, run, run someone's been stabbed."
"(The attacker) was walking really calmly like he was having an ice cream in a park. And then he went up the escalators ... and probably within about a minute we heard three gunshots," he said.
Another witness told 7News the responding inspector had saved lives.
"If she didn't shoot he would have kept going and I don't know how many more he would have done," he said.
Other witnesses told of grabbing their children and running from the centre along with hundreds of other people.
Federal Oppostion Leader Peter Dutton said Australians would be in shock over the "tragic and terrifying events" and grieving for those who died.
He thanked the police officers and first responders who acted quickly to save others.
NSW Premier Chris Minns said he was horrified to hear of the attack and was making immediate arrangements to return to Sydney.
"I want to thank NSW Police, emergency services and first responders and the community for their bravery in the face of this shocking incident," the premier said.