There is a large group of words that Spanish inherits from Greek which end in "ma" and, following their Greek roots, are masculine. They may even be the majority of words that end in "a" but are masculine.
- el clima
- el programa
- el sistema
- el lema
- el tema
- el problema
- el idioma
- el drama
Mostly they're the sorts of words that English might take from Greek. They're scientific or philosophical or technical terms.
Certainly there are other words that are masculine and end in "a". El tequila doesn't come from Greek! But this covers a big class.
Nouns ending in -μα in the nominative and -ματος in the genitive of the third declension are neuter in Greek. That includes κλίμα (clima) and σύστημα (sistema) and πρόγραμμα (programa) and all the rest I know. Of course, Spanish does not have a neuter gender.
In Latin, these words continue to be third declension neuter. Spanish «Sistema» is systēma, systēmatis; «clima» is clima, climatis.