1582 Cagayan battles

The 1582 Cagayan battles were a series of clashes between the forces of the Spanish Philippines led by Captain Juan Pablo de Carrión and wokou (possibly led by Japanese pirates) headed by Tay Fusa. These battles, which took place in the vicinity of the Cagayan River, finally resulted in a Spanish victory.
This event is a recorded battle between European soldiers and sailors against Japanese pirates, which followed similar events like the battles of Manila and Fukuda Bay. The clash pitted Spanish musketeers, pikemen, rodeleros and sailors assisted by allied native warriors against a larger group of Japanese, Chinese and likely native Filipino pirates made up of rōnin, soldiers, fishermen, and merchants (smugglers and legitimate). The pirates had a large junk, and 18 sampans which are flat bottomed, wooden fishing boats.
Around 1573, the Japanese began to exchange gold for silver on the Philippine island of Luzon, especially in the Cagayan Valley around the modern-day province of Cagayan, Manila, and Pangasinan, specifically the Lingayen area. In 1580, however, a ragtag group of pirates forced the natives of Cagayan into submission. These raiders were called wokou and had been previously fought by the Chinese Jiajing Emperor.
In response, the Governor-General of the Philippines Gonzalo Ronquillo commissioned Juan Pablo de Carrión, hidalgo and a captain of the Spanish navy, to deal with the piracy.
Ronquillo wrote to King Philip II on 16 June 1582:
Carrión took the initiative and shelled a Wokou ship, possibly of Chinese manufacture, in the South China Sea, removing it from action. A retaliation came from Tay Fusa, who sailed toward the Philippine archipelago with a fleet.
The Wokou fleet was composed of one junk and 18 sampans. Although their numbers comprised ethnic Japanese, Chinese, and Philippine raiders, the name of their leader suggests the Japanese led their fleet. Spanish sources record it as Tay Fusa, which does not correspond to a Japanese name but could be a transliteration of Taifu-san or Taifu-sama, with taifu (大夫) being a word for a Japanese medieval chieftain rank, also pronounced as tāi-hu (POJ) in Hokkien Chinese, or dàfū (pinyin) in Mandarin Standard Chinese. Meanwhile, -san (さん) or -sama (様) are Japanese honorific suffixes. They carried not only bladed weapons but also muskets, which had been provided by the Portuguese.
To counter this, Carrión gathered forty soldiers and seven boats: five small support vessels, a lightship (San Yusepe), and a galleon (La Capitana), with their respective crews. Though lesser in numbers, the Spanish were advantaged by their greater experience with firearms than the pirates, as well as the superior quality of their armor and weaponry.
On board the ships, apart from the crew, there were forty soldiers. Contrary to popular belief, they did not belong to the Tercios and no more than five or six had fought in Europe, since the majority were born in New Spain (what is today, Mexico and the Southwestern United States). They were Tlaxcalan indigenous people, veterans among others from the Chichimeca War, and fully integrated into the Spanish army, along with Iberians and Novohispanos, since these would have already participated in several of the first explorations in the Pacific and some of the wars in the region. All the weapons they carried were European, with the weapons and defenses of a common soldier. They all knew by heart, and practiced with ease the usual tactics of the Spanish formations. The flotilla would also be filled with recruits from the allied Tagalog, Pampanga and Visayan tribes.
As they passed the Cape Bojeador, the Spanish flotilla encountered a heavy Wokou sampan. It had recently arrived at the coast, and its sailors abused the native population. Carrión, although outnumbered by the wokou, engaged in a naval battle with the sampan, eventually boarding it. The Spanish rodeleros then encountered armored Japanese wokou wielding swords. Though initially successful, the Spanish soldiers were repelled back to their ship, whose deck became a battlefield. Eventually, the Spanish turned the battle again in their favor by improvising a parapet with Spanish pikemen at the front and arquebusiers and musketeers at the rear, thanks to the well-timed reinforcement of the rest of the fleet. The wokou abandoned the ships and swam away, with some drowning due to the weight of their armor. The Spanish had suffered their first casualties, among them the galley's captain Pedro Lucas.
The flotilla continued down the Cagayán River, finding a fleet of eighteen sampans and a Wokou fort erected inland. The Spanish fleet forced their way through using artillery and disembarked onshore. They dug in, assembling the artillery unloaded from the galleon in the trenches, and continually bombarded the pirates. The wokou decided to negotiate a surrender, and Carrión ordered them to leave Luzon. The pirates asked for gold in compensation for the losses they would suffer if they left, which was denied outright by Carrión. After this, the wokou decided to attack by land with a force of some six hundred strong.
The Spanish trenches, crewed by soldiers and sailors, endured a first assault, then another. In response to their pikes being seized by the Wokou soldiers, the Spanish oiled the shafts of their pikes to make them difficult to grasp. The Spanish ran low on gunpowder by the third attack, which became a close-quarters fight that almost breached the trenches. Finally, with the Wokou assaults diminishing, the Spanish emerged from the trenches and attacked, routing the remaining Wokou. They then plundered the Wokou weapons left on the battlefield, which included katanas and armor, and kept them as trophies.
With the region pacified and the arrival of reinforcements, Carrión founded the city of Nueva Segovia (now Lal-lo). The pirate activity was sparse afterward, although the impression left by the fierceness of the battle led the local Spanish viceroy to request more troops. The commercial activity near Cagayan was focused in Lingayen Bay, in Pangasinan, on the port of Agoo and consisted principally of deerskin trade.