Portugal are top of their qualifying group for Euro 2016 but rested Ronaldo against the African side, who are ranked 38th in the world.
Odair Fortes put Cape Verde ahead before Admilson Gege doubled their lead after the break.
The hosts also had defender Andre Pinto sent off after an hour.
Cape Verde - eliminated at the group stage of this year's Africa Cup of Nations - are sandwiched between Wales and Scotland in Fifa's world rankings.
The Islands are situated in the Atlantic Ocean, roughly 400 miles west of Senegal in west Africa.
Match ends, Portugal 0, Cape Verde Islands 2.
Second Half ends, Portugal 0, Cape Verde Islands 2.
Foul by André Almeida (Portugal).
Babanco (Cape Verde Islands) wins a free kick in the attacking half.
Attempt missed. Ukra (Portugal) right footed shot from outside the box is close, but misses to the left. Assisted by André Almeida.
Eder (Portugal) wins a free kick on the left wing.
Foul by Jeffry Fortes (Cape Verde Islands).
Vieirinha (Portugal) wins a free kick in the defensive half.
Foul by Nuno Rocha (Cape Verde Islands).
Vitorino Antunes (Portugal) wins a free kick in the defensive half.
Foul by Rodrigues (Cape Verde Islands).
André André (Portugal) wins a free kick in the defensive half.
Foul by Ricardo (Cape Verde Islands).
Corner,  Portugal. Conceded by Jeffry Fortes.
Attempt missed. Vieirinha (Portugal) right footed shot from the right side of the box misses to the left. Assisted by Danilo Pereira with a headed pass following a corner.
Corner,  Portugal. Conceded by Jeffry Fortes.
Ukra (Portugal) wins a free kick on the left wing.
Foul by Jeffry Fortes (Cape Verde Islands).
Attempt missed. André André (Portugal) header from the centre of the box misses to the left. Assisted by Vitorino Antunes with a cross.
Substitution, Cape Verde Islands. Ricardo replaces Júlio Tavares.
Substitution, Cape Verde Islands. Ryan Mendes replaces Héldon.
Substitution, Cape Verde Islands. Rodrigues replaces Odaïr Fortes.
Substitution, Portugal. André Almeida replaces André Gomes.
André Gomes (Portugal) wins a free kick in the attacking half.
Foul by Sérgio Semedo (Cape Verde Islands).
Vitorino Antunes (Portugal) wins a free kick in the defensive half.
Foul by Babanco (Cape Verde Islands).
Substitution, Cape Verde Islands. Calú replaces Toni Varela.
Foul by André André (Portugal).
Nuno Rocha (Cape Verde Islands) wins a free kick in the defensive half.
Corner,  Portugal. Conceded by Steven Fortes.
Ukra (Portugal) wins a free kick on the left wing.
Foul by Babanco (Cape Verde Islands).
Sérgio Semedo (Cape Verde Islands) is shown the yellow card.
Ukra (Portugal) wins a free kick in the defensive half.
Foul by Sérgio Semedo (Cape Verde Islands).
Foul by André André (Portugal).
Héldon (Cape Verde Islands) wins a free kick in the defensive half.
Substitution, Portugal. Pizzi replaces Cédric Soares.
Substitution, Portugal. André André replaces Adrien Silva.
Ten-man Portugal struggled without captain Cristiano Ronaldo as they fell to a surprise defeat in a friendly at home to the Cape Verde Islands.