Mr Khashoggi, 59, went missing on 2 October during a visit to get papers for his marriage and intense pressure had been growing on Saudi Arabia to explain his disappearance.
Saudi Arabia’s public prosecutor was quoted on state television as saying that a fight broke out between Mr Khashoggi and people who met him in the consulate, leading to his death.
It contradicts the country’s initial claim that the journalist – who was critical of the kingdom’s rulers – had left the consulate alive.
An official source claimed that “discussions” between Mr Khashoggi and others at the consulate “did not go as required and developed in a negative way, leading to a fight and a quarrel”.
It added that “the brawl aggravated to lead to his death and their attempt to conceal and cover what happened”.
Eighteen Saudis are said to have been arrested so far in connection with the journalist’s death and the state news agency said the kingdom “expresses its deep regret” over Mr Khashoggi’s death.
Saudi Arabia also said one of its top intelligence officials, Ahmed El Assiri, had been sacked, as well as royal court adviser Saud Al Qahtani.
There has been no word about what was done with Mr Khashoggi’s body.
US President Donald Trump said he found the Saudi explanation “credible”and a White House statement described the murder as a “tragic incident”.
The Foreign Office said the UK was “considering the Saudi report and our next steps. As the Foreign Secretary has said, this was a terrible act and those responsible must be held to account”.
United Nations chief Antonio Guterres is “deeply troubled” by the confirmation of the journalists’s death, said a UN spokesman.
Regional allies have struck a different tone: Bahrain, United Arab Emirates and Egypt praised Saudi Arabia’s King Salman for the way the investigation into the death had been handled.
Concerns grew for Mr Khashoggi’s safety after Turkish sources said he had been killed in a premeditated murder after a 15-man “hit squad” entered the country.
An official, speaking anonymously to Reuters news agency, said at the time: “We believe that the murder was premeditated and the body was subsequently moved out of the consulate.”
A senior police source told online news website Middle East Eye the journalist had been “brutally murdered, killed and cut into pieces”.
“Everything was videotaped to prove the mission had been accomplished and the tape was taken out of the country,” the source said.
Pro-government newspapers in Turkey published details – said to have come from those close to the case – that claim Mr Khashoggi was tortured, having his fingers cut off, before his body was dismembered on an office table by a forensic doctor.
Turkish media say authorities have audio of the alleged murder.
Major businesses and some politicians, including the UK’s trade secretary, have pulled out of a major investment summit in Saudi capital Riyadh.
Sky News special correspondent Alex Crawford, who is at the Istanbul consulate, said that confirmation of Mr Khashoggi’s death was “not too much of a surprise from our sources in Turkey”.
“I think the Saudi just thought there was nowhere else to go – they had to admit it.
“Now they’ve been backed into a corner where they’ve had to admit something very badly went wrong.”
Both Turkey and Saudi Arabia have been carrying out investigations – with forensic experts examining the consulate and the consul’s house nearby.
On Friday, the search moved to a forest outside Istanbul.