As the question notes, the change from mester de juglaría to mester de clerecía marks a change from an oral tradition to a more formalised written genre. The terms are certainly well used in Spain - any secondary school course in literature will note the existence of these two genres. In fact some say that the terms are overused - Isabel Uria Maqua, for example, in Sobre la unidad del mester de clerecia del siglo XIII argues that originally the term mester de clerecía referred to a well-defined literary school, but over time any Spanish poetry from the 12th and 13th century tended to be pigeon-holed into this classification, rather blurring its meaning. Deyermond also opposed this simple-minded classification, and called for a more modern viewpoint to be adopted:
Obviously, the old dichotomous formula, Mester de Clerecía / Mester de
Juglaría, that divides medieval literature into two opposing and
confronting groups, does not fit into the new points of view that have
been developed regarding the landscape of medieval literary
production. For this reason, a critical review of these concepts would
be appropriate, either to discard them definitively as useless, or to
establish their true scope with greater precision. In any case, the need to break with the old schemes is clear so that, once free from
the coercion that they exercise, a new classification of our
medieval literature can be begun that is more in accordance with the points of view
that is held today in this regard.
(translation by CDS)
As far as I am aware though, we are still currently stuck with "the old dichotomous formula".
The term seems to have been introduced in the second stanza of the Libro de Alexandre, which set out the "manifesto" of the mester de clerecía:
Mester traigo fermoso, non es de joglaría
mester es sin pecado, ca es de clerezía
fablar curso rimado por la cuaderna vía
a sílabas cuntadas, ca es grant maestría.
Reading 13th century Spanish is like an English speaker reading Chaucer in the original, but this could be rendered as:
I bring a beautiful art, it is not minstrelcy (juglaría)
is pure, because it is from the clergy (clerecía)
To speak in rhyming
verse, by means of the cuaderna vía
with counted syllables,
that is the great mastery.
The "cuaderna vía" refers to verses of fourteen syllables (with a caesura after the seventh) in monorhyme tetrastrophs, characteristic of the mester de clerecía, and marking the difference between this school of poetry and the less restricted form used by the mester de juglaría. This work is dated to the first third of the 13th century, but its authorship is disputed (or, in fact, unknown). It has variously been ascribed to Juan Lorenzo de Astorga (sometimes thought to be merely a scribe), Alfonso X of Castile ("Alfonso the Wise"), and Gonzalo de Berceo - one of the major poets of the mester de clerecía.