PORT ELIZABETH, South Africa (AP) -- Cape Verde reached the African Cup of Nations quarterfinals in its first appearance at a major tournament, rallying to defeat Angola 2-1 Sunday night on Heldon Ramos' goal in second-half injury time.
Angola went ahead in the 33rd minute on an own goal by Cape Verde captain Fernando Neves, but Fernando Varela tied the score with a header in the 82nd.
Host South Africa advanced when it came from behind twice to tie Morocco 2-2 at Durban.
Morocco went ahead on goals by Issam Adoua in the 10th and Abdelilah Elhafid in the 82nd, but Bafana Bafana got goals from May Mahlangu in the 71st and Tukelo Rangies in the 86th.
South Africa (1-0-2) won Group A with five points on goal difference over Cape Verde (1-0-2). Morocco (0-0-3), which would have advanced if Ramos had not scored, finished third, followed by Angola (0-2-1).