The dead, in what police called a "marauding terrorist attack," included the assailant and the policeman he stabbed. The other three victims were among those hit by the car as it sped across Westminster Bridge before crashing into railings just outside parliament, Reuters said.
Prime Minister Theresa May condemned the attack as "sick and depraved".
"The location of this attack was no accident," she said in a statement outside her 10 Downing Street office late in the evening.
"The terrorist chose to strike at the heart of our capital city, where people of all nationalities, religions and cultures come together to celebrate the values of liberty, democracy and freedom of speech."
Read alsoLondon attack in detailsAny attempt to defeat those values through violence was "doomed to failure", May said.
Mark Rowley, Britain's most senior counter-terrorism officer, told reporters the attack started when a car was driven over Westminster Bridge, hitting and injuring members of the public and three police officers.
"A car then crashed near to parliament and at least one man, armed with a knife, continued the attack and tried to enter parliament," Rowley said.
He said the police's "fast-paced investigation" was working on the assumption that the attack was "Islamist-related terrorism". Police believed they knew the identity of the attacker but would not provide details at this stage, he said.
It was the deadliest attack in London since four British Islamists killed 52 commuters and themselves in suicide bombings on the city's transport system in July 2005, in London's worst peacetime attack.
Read alsoLondon Police treating incident outside parliament "terrorist" act (photo, video)It took place on the first anniversary of attacks by Islamist militants that killed 32 people in Brussels.
Reuters reporters inside parliament during Wednesday's attack heard loud bangs and shortly afterwards saw the knifeman and the stabbed policeman lying on the ground in a courtyard within the gates of parliament.
The dead police officer was identified as Keith Palmer, 48, with 15 years of service.