Several people were stabbed by the knifeman before he was grappled to the ground and disarmed by members of the public on London Bridge.
A Whitehall source told the PA news agency that two of the victims had died.
Footage on social media showed one man being urged to move away by armed officers before the suspect was shot at point-blank range, as another bystander could be seen carrying a large knife from the scene.
Another video appeared to show a person on a stretcher, surrounded by emergency services staff and vehicles, being given CPR by responders following the attack.
The members of the public who intervened have been widely praised, with Mayor of London Sadiq Khan hailing their "breathtaking heroism" and Prime Minister Boris Johnson their "extraordinary bravery".
Witnesses said the suspect appeared to be wearing a suicide vest but Neil Basu, the head of UK counter-terrorism policing, said the vest was a fake.
He said police were called at around 2pm on Friday to a stabbing "at a premises near London Bridge".
The bridge was the scene of a terror attack in 2017 - also during a general election campaign - when eight victims were killed along with the three terrorists, who were also wearing fake suicide vests and armed with knives.
After being shot, the suspect in Friday's attack raised his arms towards his head before lying still. A second knife could be seen on the ground near his body.
Mr Basu told reporters: "A male suspect was shot by specialist armed officers from City of London police and I can confirm that this suspect died at the scene."
The London Ambulance Service declared it a major incident and one picture on social media appeared to show a body covered with a blanket.
Speaking in Downing Street, Mr Johnson said: "To the best of our knowledge the incident has been contained and I pay tribute again to the work of the police and the emergency services and what they have done.
"But I would urge everybody, of course, to be vigilant and one cannot help but think back to what happened in 2017 in the same part of the city and I hope very much that people will be able as fast as possible to go about their normal business."
The Independent Office for Police Conduct watchdog said it has launched an investigation into the police shooting of the London Bridge attacker which is standard for such incidents.
Witnesses described a scene of panic around London Bridge, moments after the incident.
Nurse Jackie Bensfield, 32, described how she asked to be let off a bus on London Bridge after she heard "five or six" gunshots.
Ms Bensfield, who was on her way home from work, said she exited the bus and "ran like hell" to escape the shots.
Cecilia Sodero was on the top deck of a bus going over London Bridge when she heard shots and saw a man lying on the ground with a "very scary device, like a bomb device".
She told Sky News she saw "six people holding someone on the floor", adding: "At some point someone says 'oh, he has a knife', and we were like, oh my gosh, this guy is supposed to stab someone and people was running away.
"The police officers finally they removed the knife. But then what happened is when they shot the guy, the guy is still alive, and they shoot and he's trying to pull the black jacket off so I was able to see the vest that he was wearing.
"And it seems like a very scary device, like a bomb device, at that point we just ran away from the bus."