The move will end the United States’ dependence on Russia.
The American space agency also considered a bid by privately owned aerospace company Sierra Nevada, but opted to award established aerospace contractor Boeing and California’s SpaceX with contracts valued at a combined $6.8 billion (£4.1bn) to develop, certify and fly their seven-person capsules.
Boeing was awarded $4.2bn and SpaceX $2.6bn.
SpaceX chief executive Elon Musk, a South African-born billionaire, said: “SpaceX is deeply honoured by the trust Nasa has placed in us.
“It is a vital step in a journey that will ultimately take us to the stars and make humanity a multi-planet species.”
The awards mean Boeing and SpaceX will be ready for commercial flights in 2017, said Kathy Lueders, manager for Nasa’s commercial crew programme.
She said both contracts have the same requirements. She added: “The companies proposed the value within which they were able to do the work and the government accepted that.”
The contracts have taken on new urgency given rising tensions between the US and Russia over its annexation of the Crimea region of Ukraine and support for rebels in east of the country.
Boeing’s CST-100 spaceship would launch aboard Atlas 5 rockets, built by United Launch Alliance, a partnership between Lockheed Martin and Boeing.
SpaceX, which already has a $1.3bn Nasa contract to fly cargo to the space station, intends to upgrade its Dragon freighter to carry astronauts.
John Elbon, Boeing’s general manager of space exploration, said: “Boeing has been part of every American human space flight programme, and we’re honoured that Nasa has chosen us to continue that legacy.”
Nasa has said that in addition to test flights, the awards would include options for between two and six operational missions. By flying astronauts commercially from the US, Nasa could end Russia’s monopoly on space station crew transport.
US astronauts have been travelling on Russian rockets ever since Nasa’s space shuttles retired in 2011.
The agency pays $70 million per person for trips on Russian Soyuz capsules and Nasa puts at least four of its astronauts on one every year.
SpaceX has indicated its seats will cost $20m each.
China, the only other country to fly people in orbit apart from the US and Russia, is not a member of the 15-nation space station partnership.
Nasa has spent about $1.5bn since 2010 investing in partner companies under its commercial crew programme.
Boeing and SpaceX have won most of Nasa’s development funds. The companies retain ownership of their vehicles and can sell trips to customers other than Nasa, including private tourists.
“The work that we have under way is making the possibility for everyone to someday see our planet Earth from space,” said Kennedy Space Centre director and former astronaut Bob Cabana.
“I know a lot of us are cheering on the success of our commercial crew programme, not because of what it means to Nasa but what it means to human spaceflight for everyone.”