The asteroid is currently on a similar path to Earth but will fly back out into space over the next few days.
Nasa has released a video of 2012 TC4 as it zoomed past Earth.
The footage shows what looks like a flickering star moving diagonally from top left to bottom right.
The asteroid is about 31,000 miles away – around an eighth of the distance between the Earth and the moon – and the video was captured by the 1.0-meter Kiso Schmidt telescope in Nagano, Japan.
Asteroid 2012 TC4 is shooting past Earth
At between 10 and 30 metres in size, it is believed to be bigger than the Chelyabinsk meteor which exploded above Russia, damaging thousands of buildings and injuring 1,500 people in 2013.
Nasa is using the extremely close fly by to gather valuable data on the space rock.
Michael Kelley, programme scientist and Nasa Headquarters lead for the TC4 observation campaign, said: “Scientists have always appreciated knowing when an asteroid will make a close approach to and safely pass the Earth because they can make preparations to collect data to characterise and learn as much as possible about it.
The asteroid is up to 30 metres in size
“This time we are adding in another layer of effort, using this asteroid flyby to test the worldwide asteroid detection and tracking network, assessing our capability to work together in response to finding a potential real asteroid threat.”
The path of the asteroid has been described as a “close miss” by scientists as, in astronomical terms, it is just a hair’s width away.
“This is indeed a close miss.”
Rolf Densing, head of the European Space Operations Centre in Darmstadt, Germany, said: “It’s damn close.
“The farthest satellites are 36,000 kilometres (22,400 miles) out, so this is indeed a close miss.”