Local media have named those who died as Lindt cafe manager Tori Johnson, 34 and lawyer Katrina Dawson, 38.
Four people were injured, including a policeman hit by shotgun pellets.
Central Sydney was put in lockdown as the gunman, identified as an Iranian refugee, seized dozens of hostages early on Monday.
The Lindt Chocolat Cafe is located in Martin Place, a busy shopping area in Sydney’s financial district.
The gunman, named as Man Haron Monis, forced some of the hostages to hold up a black Islamic banner at the window of the cafe.
Monis received political asylum in Australia in 1996 and was on bail facing a number of charges.
Prime Minister Tony Abbott said the “horrific incident” at the cafe had been “tragic beyond words” and there were “lessons to be learned” from this “brush with terrorism”.
“These events do demonstrate that even a country as free, as open and as generous as ours is vulnerable to acts of politically motivated violence but they also demonstrate that… we are ready to respond,” he told reporters.
Flags are to fly at half-mast across New South Wales to honour the victims.
A 34-year-old man and a woman aged 38 were pronounced dead after being taken to hospital, as was the gunman, the New South Wales police force said in a statement.
Two women suffered non-life threatening injuries as did a policeman who had been hit in the face by pellets.
Another woman suffered a gunshot wound to her shoulder.
Swiss chocolate-maker Lindt, the owner of the cafe, said in a statement: “We are devastated by the loss of their lives and that several others were wounded and had to experience such trauma.”
New South Wales state police commissioner Andrew Scipione said it had been an “isolated incident”.
Seventeen hostages were accounted for, including those who had managed to escape earlier, he said.
Local media reports suggest the commandos from the Royal Australian Regiment entered the building after the gunman started firing shots.
Commissioner Scipione urged people not to “speculate” about what had happened inside the cafe and said police believed more lives could have been lost if officers had not entered the cafe at that point.