Mr Armstrong, who turned 82 on Sunday, had surgery to relieve four blocked coronary arteries.
As commander of the Apollo 11 mission, Mr Armstrong became the first man to set foot on the Moon on 20 July 1969.
In a statement, Nasa administrator Charles Bolden wished the "true American hero" a quick recovery.
"Neil's pioneering spirit will surely serve him well in this challenging time," Mr Bolden said.
Fellow Apollo 11 astronaut, Buzz Aldrin, tweeted that he was "sending my best wishes for a speedy recovery- we agreed to make it the 50th Apollo Anniv in 2019".
Eugene Cernan, the last man to walk on the moon, told NBC News that the 82-year-old's wife, Carol Armstrong, said her husband was in high spirits.
Mr Armstrong failed a stress test on Monday, leading to the surgery.
He has largely kept out of the spotlight after his famous moonwalk, but testified in front of Congress in September 2011 on Nasa's future, along with Mr Cernan.
Mr Armstrong, along with three other astronauts, received the Congressional Gold Medal, the highest US civilian award, in November.
Former US astronaut Neil Armstrong, the first man to walk on the Moon, is recovering after undergoing heart bypass surgery on Tuesday.