"A man blew himself up on a beach in Sousse," ministry spokesman Mohamed Ali Laroui told AFP, adding that no one else was killed.
Within just half an hour, security forces foiled another suicide attack by an 18-year-old man on the tomb of former president Habib Bourguiba, in neighbouring Monastir, 20 kilometres along the coast.
Tunisian special forces later arrested "five terrorists with direct links to the assailants" in Sousse and Monastir, the interior ministry said.
Ministry spokesman Mohamed Ali Laroui said those behind the attacks belonged to Ansar al-Sharia, Tunisia's main Salafist movement, which the authorities have designated a "terrorist organisation" with ties to Al-Qaeda.
Since the 2011 revolution that toppled Zine El Abidine Ben Ali, Tunisia has been rocked by violence blamed on radical Islamist groups suppressed under the former dictator, including the killings this year of two opposition MPs.
But Wednesday's failed suicide bombings are the first in Tunisia since 2002, when an attack claimed by Al-Qaeda killed 21 people at the ancient Ghriba synagogue on the resort island of Djerba.
The Tunisian presidency the violence will not succeed in "derailing" the country's political transition.
It was referring to a national dialogue underway between the ruling Islamists party Ennahda and the opposition to end months of political crisis, sparked by the July assassination of opposition politician Mohamed Brahmi by suspected jihadists.
Ennahda's veteran leader Rached Ghannouchi, who has been criticised in the past for encouraging dialogue with Tunisia's hardline Salafists, denounced "those who tried to target tourists," calling them "criminals who want to destroy Tunisia, its economy and its democratic transition."
Fears for tourism
The bomber in Sousse tried to enter the hotel by a back door but was spotted by guards and chased from the complex, blowing himself up instead on the nearby beach which was deserted, witnesses told AFP.
The interior ministry said anti-terrorist units were sweeping the area looking for an accomplice who fled, and an inquiry has been opened into the circumstances of the attack.
Shortly after the blast, a spontaneous protest was held in the centre of Sousse "to condemn terrorism," witnesses said.
In Monastir, Laroui said a planned attack on the compound of the Bourguiba mausoleum was foiled when a young man carrying explosives was arrested before he managed to blow himself up.
Last year a Salafist was jailed for eight months for desecrating the tomb, a lavish building with two minarets and a gold dome that was commissioned by Bourguiba himself, Tunisia's staunchly-secular first president.
A photographer said residents saw the would-be attacker behaving suspiciously in a cemetery near the tomb and reported him. He was arrested by presidential security guards.
Private radio station Mosaique FM identified the suspect as Aymen Saadi Berchid from northern Tunisian and said four arrest warrants had previously been issued for him.
Police also found "a large quantity of explosives" in a clifftop house near the marina in Monastir, according to Shems FM.
Wednesday's planned attacks are likely to fuel fears for Tunisia's stricken tourist sector, which has been largely untouched by the surge in jihadist violence since Ben Ali's ouster and which generates vital revenues for the cash-strapped government.
Extra security was meanwhile deployed at hotels in Tunis amid fears of another attack.
The French embassy urged "increased vigilance," and advised its citizens to avoid meeting places, while German Foreign Minister Guido Westerwelle assured his Tunisian counterpart Othman Jarandi of Berlin's continued support for the transition process.
Ennahda party, which swept Tunisia's first post-revolutionary elections in October 2011, has been sharply criticised by the opposition for failing to combat a rise in jihadist militancy.
The army on Tuesday launched a "huge" operation to track down jihadists in the central Sidi Bouzid region, after six policemen were killed in the area last week.
The government has linked Tunisia's armed jihadists to Al-Qaeda in the Islamic Maghreb, but it has admitted lacking adequate resources to combat them.