The only free and comprehensive online etymological dictionary of the Spanish language
-mente Adverb-forming suffix akin to "-ly."
Originally Old Spanish -mientre, under contamination from -iter, and -miente, but replaced by dialect variation -mente. From Vulgar Latin *-mente 'id.' From Latin mente "by the mind," from mens "mind." See mente for further etymology.
Indo-European
Romance
Asturian -miente, Portuguese -mente, Galician -mente, Catalan -ment, French -ment, Italian -mente, Neopolitan -mente, Sardinian -menti

The grammaticalization of mente into a suffix was an ancient process of referring to mental states by saying "with a ____ mind." For example, studiosa mente "with a studious mind" (Pharies 2008). It later crystalized as a suffix when speakers referred to any and every action with mente, thus generalizing its role and securing its place as a suffix (Dyer 1972). The addition of mente was largely a Vulgar Latin habit, in Classical Latin the traditional word was modo "way."

Ellision of the suffix is uneven across the Western Romance languages. In Spanish, the suffix is ellided until the final adverb (e.g. rápida y locamente), but in French the suffix is never ellided and in Catalan the first adverb takes the suffix while the subsequent are ellided (e.g. rápidament i silenciosa) (Castells 2013). "In modern Spanish, -mente is no longer perceived as a noun (its congener miente is now confined to a few idiomatic expressions), but it can still be detached from its host adjective in order to avoid awkward repetition.... ~ Harris & Vincent, The Romance Languages (2003)