The Spanish Inquisition did not come to an end all at once. Instead, it was abolished, restored and abolished several times. Here's an overview:
1478: Established after being authorised by Pope Sixtus IV.
1808: Joseph Bonaparte, who had been installed as King of Spain by Napoleon, abolished the Inquisition in the territories under his control. However, his rule was not recognised by many Spaniards.
1813: The Cortes of Cádiz, the liberal Spanish parliament, also abolished the Inquisition - this time as an act of the legitimate Spanish government.
1814: After returning to the Spanish throne, King Ferdinand VII restored the Inquisition.
1820: During the Liberal Revolution in Spain, the Inquisition was suppressed again.
1823: After Ferdinand VII regained absolute power, he restored the Inquisition once more.
On 15 July 1834, Queen Regent Maria Christina finally abolished the Spanish Inquisition by royal decree on behalf of the young Queen Isabella II.
https://en.wikipedia.org/wiki/Spanish_Inquisition#End_of_the_Inquisition
https://www.britannica.com/topic/Spanish-Inquisition#ref327586