Ok so this is similar to the question "what were electric eels called before the discovery of electricity", but somewhat different.
In English, the word is just Thunderstorm so it can be a very old name. However, in Spanish it's common to say "tormenta eléctrica", which just means electric storm, so it must be kind of a modern name. Before electricity was discovered, or even before it was established that thunderstorms were electrical in nature, what were they called in Spanish?
I will preface this answer by saying that I'm a siglodeorista; or, basically someone who studies the Spanish Golden Age (roughly 1492-1695 is how I would define it). That being said, since your question seems to enter into the realm of philology, I hope to answer it by citing texts from the Spanish Golden Age, as this was a period before the discovery of electricity. Assuming that you read Spanish, I leave the texts as they are without translating them.
One of the earliest dictionaries we have, Sebastián de Covarrubias's Tesoro de la lengua castellana (1611) registers two words for storms, but none of them make any reference to thunder. As is the case in modern Spanish, he glosses both "tempestad" and "tormenta." Here are their definitions:
TEMPESTAD: la fortuna en la mar. Latin: procella, tempestas. También se llama en la tierra tempestad quando viene algún grande aguaducho con vientos recios. Tempestuoso, el tiempo recio.
TORMENTA: la tempestad en la mar quando es combatida de recios vientos. Latine: tempestas
Going forward in time a bit to the Real Academia Española's Diccionario de autoridades (1739), we see the appearance of other elements in these definitions, particularly of thunder:
TEMPESTAD: Privativamente se toma por la perturbación del áire con nubes gruessas de mucha agua, granizo ò piedras, truenos, rayos y relámpagos. Lat. Tempestas. MARM. descrip. lib 4. cap 79: «Resisten la tempestad de la nieve, que cae en aquellas sierras». AMBR. MOR. lib. 8. cap. 27: «Siendo yá mui adelante el verano, sobrevino tanta lluvia, que no se acordaban los naturales de haber visto semejante tempestad»
As you can see, by the time the 18th century rolls around, the definition of "tempestad" already includes hailstorms (granizo o piedras) as well as thunderstorms (truenos, rayos y relámpagos). Despite the rather late registering of this definition of the word "tempestad," however, it was common simply for one to explain or expound upon what kind of storm they were talking about when they used the word.
Cristobál de Villalón, for example, writes: "y ansí suçedió a esto que nos sobrevino luego una tan fragosa y espantosa tempestad... bramava el viento y el tempestuoso mar con espantosos truenos y temerosos relámpagos y mostrándose el çielo turbado con espessas plubias nos tenía a todos desatinados." Note that he includes lightning (relámpagos) and thunder (truenos).
The excellent poet Garcilaso de la Vega likewise in one of his poems: "la negra tempestad en muy serena / y clara luz convierte, y aquel día / si quiere revolvelle, el mundo atruena."
Diego Ortúñez de Calahorra: "Y de más desto, comiençan unos truenos y relámpagos muy temerosos, que la ciudad parescía hundirse. Y no uvo ninguno tan esforçado que de ver la súbita y arrebatada tempestad no recibiesse gran pavor..."
I could cite more texts, but I believe that the point is clear: at least in the Golden Age, it was common to use the word "tempestad" along with substantive descriptors to talk about thunderstorms. I don't know enough about medieval Spanish texts to make the same conclusion, nor about text further along in the early modern period.
Bibliography:
Corpus diacrónico del español, web.: http://corpus.rae.es/cordenet.html
Covarrubias Orozco, Sebastián de. Tesoro de la lengua española, eds. Ignacio Arellano & Rafael Zarra. Universidad de Navarra, 2006.
Dicionario de Autoridades, web.: https://apps2.rae.es/DA.html
Ortúñez de Calahorra, Diego. Espejo de príncipes y cavalleros, ed. Daniel Eisenberg. Espasa-Calpe, 1975.