The history of Spanish ensigns is a difficult one to follow, since the forming of Spain as a nation in the 15th century until the establishment of the red-gold-red ensign by royal decree on May 28th 1785. As far as I know, from Charles I (1518) until Charles II (1665), the main symbol, in different designs, of the Spanish ships, was the red Burgundy cross on different field colours, most frequently white [but also blue]. Only sometimes were royal standards or standards with religious symbols, on red and crimson fields, to be seen. The only documented ensign apart from that is the one used by the Spanish Galleons.

José Carlos Alegría, 23 Oct 2000

The Spanish Armada ships are among the few on which some flag information from contemporary sources has been researched, according to which they used the red-white-yellow flag as ensign, though they might have used the red-burgundy-cross-on-white flag as jack.

This would have been Portugal's flag at the time of Magellan's birth, though it
changed early in his life.

James Dignan, 06 Oct 2003

Magellan was Portuguese and had previously been sworn
to the King of Portugal, but he annoyed the king enough that he
released him from his service; thereupon Magellan approached King
Charles of Spain, who was willing to support his planned voyage.
The excerpt is from "Over the Edge of the World" by Laurence
Bergreen (2003, Perennial edition 2003, ISBN 0-06-093638-X);
the incident occurred on Saturday, October 13 (O.S.), 1518.
I have taken the liberty of adding some paragraph breaks for
legibility:

Even now, writing to King Charles, he had to rely on a scribe,
"because I still do not know how to write in Spanish as well
I should." He proceeded to explain the matter. "I had to
haul one of the ships to shore because there was an ebb tide.
I got up at three in the morning to make sure that the riggings
were in place and when it was time to work I ordered the men
to put up four flags with my coat of arms on the mast where
those of the captain are customarily placed, while those of
Your Majesty were to be placed on top of Trinidad, which is
the name of the ship."

The unusual juxtaposition of signs, emphasizing that a
Portuguese captain was sailing for Spain, attracted a large,
gossipy crowd of onlookers. "Because in this world there is
never any lack of envious people, they began to talk. They said
I had done wrong in putting up my coat of arms on the capstan."
The crowd thought that the four flags containing Magellan's
coat of arms signified those of the King of Portugal.

Resentment boiled along until a functionary ordered Magellan
to remove the offending flags. "I approached him and told him
that those flags were not of the King of Portugal but my own,
and that I was a vassal of Your Majesty." And he refused
to remove the flags. Another Spanish official approached
Magellan with the same demand. No, Magellan explained, he
would not take down the flags.

As Magellan was explaining all this to the official, the man who
had first approached him, "without any warning and without any
authority to do so... came up the steps calling the people to
seize the Portuguese captain who had put up the flags of the
King of Portugal." He demanded to know why Magellan chose to
display these flags, and Magellan, not surprisingly, refused
to explain.

At that moment, chaos erupted. The insolent functionary
"called military officers to seize me and laid his hands on me,
shouting that they would seize me and my men." Worse, "There
were some who showed their intentions to harm my men rather
than to help us do what was for the service of Your Majesty."
At that point, the two officials who had challenged Magellan
got into a fight with each other over how to treat Magellan.
The workmen outfitting Trinidad quickly fled, as did a number
of the sailors, further exasperating Magellan, who stood by
helplessly as he watched the local officials disarm the sailors,
and even arrest several of them and lead them away to prison.
In the struggle, one of Magellan's pilots was stabbed as he
was going about his work.

Although Magellan escaped harm, his dignity and authority
had suffered a blow. To make matters worse, the fight had
occurred in the open, under the watchful eye of a Portuguese
spy, who would carry news of the brawl back to Lisbon.

[...]

Within days of receiving Magellan's letter, King Charles
demonstrated his loyalty and punished the offenders – those
who had boarded Trinidad, stabbed the pilot, seized Magellan
himself – and arrested the sailors [sic]. Preparations for the
voyage continued, but the flag incident served as a warning
to Magellan that his men, especially the Spaniards, posed a
danger as great as the sea itself.

Mark Brader, 08 Sep 2005

The arms of Fernão de Magalhães were argent three fesses chequy of gules and argent. As shown (a modern version) here, though I am not sure wheter the mentioned flags were simple BoAs. Either way, these arms are very different from those of Portugal.

The contemporary (late 1490s) "national" flags of Spain may be viewed here, those of Portugal here and here.