The German prevailed at the end of the 198.8km stage between Faro and Albufeira, beating local hero Thiago Machado (Radioshack) and team-mate Theo Bos to the line.
Mark Cavendish was only sixth after Martens jumped clear in the final kilometre.
Eduard Vorganov (Katusha), Sergio Paulinho (Saxo-Tinkoff), Amets Txurruka (Caja Rural), Marco Corti (Colombia Coldeportes) and Chris Jones (UnitedHealthcare) formed an early escape.
They built up a lead of three minutes as they crossed the day's only mountain climb but were caught with 8km remaining to set up the gallop to the line.
It was a second win of the season for Martens who also triumphed in stage four of the Vuelta a Burgos.
Britain's Cavendish and German Tony Martin are the headline acts in the 39th edition of race.
Cavendish (Omega Pharma-Quickstep) is taking part for the first time in the Tour of Algarve after his victory last week at the Tour of Qatar.
German Martin, winner of the 2011 edition, is favourite for the race which has been reduced by one stage to four days and concludes on Sunday with a 34.8km individual time trial.