Born and raised in a township, Mandla Maseko has spent his life at the mercy of the heavens. "Once it rains, the lights go out," the 25-year-old said. "I do know the life of a candle."

But from this humblest of launchpads, Maseko is poised to defy the laws of physical and political gravity by becoming the first black African in space.

The DJ is among 23 young people who saw off 1 million other entrants from around the world to emerge victorious in the Lynx Apollo Space Academy competition. Their prize is to be blasted 62 miles up on a sub-orbital flight aboard a Lynx mark II shuttle in 2015.

"It's crazy," said Maseko, the son of a toolmaker and cleaning supervisor. "It hasn't really sunk in yet. I'm envious of myself.

"I'm not trying to make this a race thing but us blacks grew up dreaming to a certain stage. You dreamed of being a policeman or a lawyer but you knew you won't get as far as pilot or astronaut. Then I went to space camp and I thought, I can actually be an astronaut."

He will be the second South African in space following Mark Shuttleworth, a white entrepreneur and philanthropist who bought a seat on a Russian Soyuz capsule for £12m and spent eight days on board the international space station in 2002.

Maseko's father, who grew up in such poverty that he got his first pair of shoes when he was 16, was determined that his children would never go hungry. Maseko and his four younger siblings were brought up in a simple brick house with access to electricity and running water. "I don't remember going to bed without having eaten," he said. "My dad provided for us. He is my hero, and then Nelson Mandela comes after."

The young Maseko's imagination was fired by the science fiction series Star Trek and films such as Armageddon and Apollo 13. "I thought, that looks fun. No matter what life throws at you, you can use it and come out on top. If you get lemons, you must make lemon juice."

Maseko does not drink or smoke, does not have a girlfriend and lives with his parents in Mabopane township near the capital, Pretoria. He enrolled as a part-time civil engineering student but had to drop out due to lack of funds. Then this year he spotted an advert for a chance to go into space. "I was in the right place at the right time and in the right frame of mind."

The competition required him to send in a picture of himself, so he got a friend to photograph him in mid-air after jumping off a wall. It also asked him to explain his motivation. "I want to defy the laws of gravity," he answered.

He was among three South Africans – one black, one white, one of Indian origin – selected from a field of 85,000 hopefuls. "We wanted to show South Africa is way past the colour of our skin. We are the human race."

In the first week of December they went to the US to join more than 100 international contestants at a space camp in Orlando, Florida. The challenges included assault courses, skydiving, air combat and G-force training, building and launching a rocket, and a written aptitude test. The judges included the astronaut Buzz Aldrin. "I got to shake his hand three times," Maseko recalled. "I was like, oh, is this you? He said yes, it is me!"

Aldrin is among 12 people – all American, all men and all white – to have walked on the moon. But Africa has growing space ambitions: the majority of the Square Kilometre Array, the world's biggest and most powerful radio telescope, will be spread across South Africa and eight other countries on the continent.

Maseko, whose Twitter profile shows him in a spacesuit, is aware of his own symbolism nearly two decades after the dismantling of racial apartheid. "I'm a township boy and I'm doing this for the typical township boy who wasn't born with a silver spoon," he said. "I'll be the first black South African and the first black African to go into space. When you think of the firsts, the first black presidents – Barack Obama, Nelson Mandela – just to know your name will be written with those people is unbelievable.

"South Africa has come a long way. We have reached a stage where we are equal and we are one. Next year is the 20th anniversary of democracy and what better way to celebrate than sending the first black South African into space?"

• This article was amended on 2 January 2014. An earlier version said the winners of the Lynx Appolo Space Academy competition would be blasted into orbit. It will be a sub-orbital flight.