The statement was posted on a website on Wednesday often used by the group led by Abu Musab al-Zarqawi.
Its authenticity could not be immediately verified. But the killings were confirmed by the office of Algerian President Abdelaziz Bouteflika.
Al-Qaida's statement said: "Your brothers in the al-Qaida Organisation in Iraq ... have killed Ali Belaroussi, the chief of the Algerian mission, and diplomatic attache Azzedine Belkadi." It was not accompanied by a video or pictures.
"It (Algeria) had sent these two apostates as allies to the Jews and Christians in Iraq," the group said.
"Iraq will not be safe for God's enemies. Haven't we warned you against allying yourselves with America?" the group said.
The Algerian government vowed to "pursue with cold determination" those behind the killings.
"The hostage-takers have cowardly assassinated our two representatives in Baghdad, Ali Belaroussi and Azzedine Belkadi, thus carrying out their despicable threats despite all the appeals and exhortations launched everywhere for their liberation," a government statement said.
"Iraq will not be safe for God's enemies. Haven't we warned you against allying yourselves with America"
Iraqi al-Qaida statement
Staff at Algeria's Foreign Ministry earlier observed a minute of silence for the diplomats and Foreign Minister Mohamed Bedjaoui went to meet the envoys' families, a government official said.
UN Secretary-General Kofi Annan condemned the killings.
"I cannot but condemn this senseless and brutal killing of innocent diplomats," he told reporters in New York and urged the United Nations to agree on a treaty against terrorism.
On Tuesday, the al-Qaida in Iraq group posted on the same internet site a video showing the envoys blindfolded.
This month, the group said it had killed Egyptian mission chief Ihab el-Sherif, who was also kidnapped in Baghdad.
Attacks have driven diplomats from the Iraqi capital, undermining the US-backed government's efforts to gain support among Arab countries.
On Monday, Algeria pulled its last diplomatic staff out of its embassy in Baghdad.