The reigning under-17 European champions proved too strong for Ireland as they ran out 4-0 victors on home turf in Bercelos, allowing them to top the Elite Round group standings ahead of their opponents and book their spot in July's finals in Finland.
A promising start to the group saw Ireland draw with Slovakia, in a game that Flanagan played in before he sat out a win against Kosovo that set up a decider against Portugal.
Flanagan featured for 86 minutes of the game but goals from Gedson Fernandes and Diogo Queirós put the home side in firm control. The task was made harder when Aaron Connolly was sent off for two bookable offences, and Portugal took advantage with two further goals from Pedro Correia and Fernandes.
The result meant Flanagan's team finished second in the table with six points from their three games garnered during their week in northern Portugal.