The city had been preparing to celebrate her eighteenth birthday. Two days later it was mourning her death. On the twenty-fourth of June 1878 the Cardinal Primate came to the Royal Palace of Madrid and anointed the dying Queen of Spain with holy oils. She had been married for five months.

María de las Mercedes had not been the politically convenient choice. Alfonso XII had fought his mother Queen Isabella II and the pressure of every diplomatic calculation available to a nineteenth-century monarchy to marry her. Isabella refused to attend the wedding. The match made no strategic sense to anyone except the king himself, who had known Mercedes since childhood and wanted no other wife. They married on the twenty-third of January 1878. She was seventeen years old.

The decline began almost immediately after the honeymoon. She suffered a miscarriage following a long horse ride and then a fever that the doctors could not bring down. By late May she was weakening steadily. On the twenty-second of June she began suffering from haemorrhages. The official medical report called it nervous gastric fever. It was almost certainly typhoid. The doctors prescribed camphorated oil and injections of ferric chloride to fight the anaemia. Her fever on her birthday stood at one hundred and four degrees Fahrenheit. There was nothing further to prescribe. The Cardinal came.

Madrid had prepared public illuminations for the birthday of its young queen. Instead the streets filled with prayer vigils. Crowds gathered outside the Royal Palace and stayed through the night. She died on the twenty-sixth of June 1878 in the same Royal Palace in which she had been born. She was eighteen years old and two days.

Her death moved through Spain and across Latin America in the form of folk songs composed within days of her dying. The most famous passed from adults to children and was still being sung in playgrounds a generation later:

¿Dónde vas, Alfonso XII, dónde vas, triste de ti? Voy en busca de Mercedes que ayer tarde no la vi.

Where are you going, Alfonso XII, where are you going, sad man. I am going in search of Mercedes whom I did not see yesterday afternoon.

Alfonso XII never recovered. He died seven years later aged twenty-seven of tuberculosis. He had named his daughter by his second wife María de las Mercedes in her honour. His dying wish was that Mercedes's remains be transferred to the Almudena Cathedral he had commissioned in her memory. It took until the year 2000 for that wish to be fulfilled.

Her tomb bears the Latin inscription dulcissima uxor Alfonsi XII: sweetest wife of Alfonso XII.