Police identified the victim as the head of the visa section at the Spanish embassy.
The victim was 61 and had been living in Sudan for three years, police said, adding that he was found dead at his residence at dawn in Khartoum's eastern district of Garden City.
The police and the foreign ministry said that an investigation was under way, and the foreign ministry suggested in a separate statement that he was murdered.
"The police force of Khartoum state and its teams of special criminal investigators have launched a probe in order to find the perpetrator or perpetrators as soon as possible," the foreign ministry statement said.
"The foreign ministry is confident that the perpetrators of this crime will be found," it added.
The ministry described the diplomat's death as a "regrettable incident that took place at dawn" on Monday.
"The foreign ministry expresses its condolences to the Spanish embassy, and the family of the departed, for their painful loss," it said.
A Spanish foreign ministry spokesman confirmed the man was the head of the visa section at the embassy "but did not have the status of a diplomat."
"An investigation has been opened and our embassy is in contact with Sudanese police and the Sudanese interior ministry," he added.