The caboclo de lança (mestizo with a spear) is a folkloric warrior figure from Pernambuco, tied to the cultural manifestations of Carnival and of Maracatu Rural. It is considered by many to be one of the principal symbols of Pernambucan culture. The other lesser-known names one might hear are lanceiro africano (African spear thrower), caboclo de guiada (another name for lança is guiada) or guerreiro de Ogum (an Ogum warrior).
Its origin is the result of a mixture of Afro-indigenous cultures with other popular manifestations, like Bumba-meu-boi, Caboclinhos, Cavalo-marinho, and Folia de Reis, which can all be found in Pernambuco.
Until the 1920s, the caboclos de lança, mostly workers in sugarcane plantations, did not arouse much interest or fascination since they lived and paraded in the inner cities of Pernambuco. In the 1930s, there was a the decline of the sugarcane mills and, with it, the growth of industrialization and modernization of the economy. This resulted from the Revolution of 1930 and thus brought about the displacement of people from the countryside to the cities and the coast. With those people, the rich traditions of the Zona da Mata (sugarcane region) arrived in Recife, including (and especially during Carnival), Maracatu Rural and its colorful characters.
The ritual that precedes the presentation of the caboclo de lança, whether in the countryside or in the city, involves ceremonies that happen on sacred land (terreiros). They include the blessing of the spears and the flower that goes in the caboclo’s mouth, the consecration of the calunga (a doll representing divinity, held by the Bahian figure in the parade), and also a promise (by the man) of sexual abstinence, which starts a few days before Carnival.
For more info, here is a great blog (in PT) by Anna Anjos called Cocada Preta which, towards the bottom, speaks about Maracatu, including how it ties into African religions. Each post of hers is like a dissertation, and only for those who really want to dig in. Also, if you want to learn about the making of the outfit, you can check out a very small section (from 22:10 – 23:30) of this documentary (PT).