China overtook the United States as the world's largest trading nation in 2012, with two-way trade in merchandise totaling $3.867 trillion, according to data released by China and the U.S.

China logged $3.9 billion more in trade with the rest of the world last year than did the United States, which logged a 3.5 percent rise to $3.863 trillion, figures released by the U.S. Commerce Department said Friday.

China's trade has been expanding rapidly since it joined the World Trade Organization in 2001, a move that allowed it to enjoy the same trade rules that govern most global trade.

With its export-fueled economy expanding by leaps and bounds, China overtook Germany as the top exporter in 2009.

In 2012, Chinese exports totaled $2.049 trillion, compared with $1.564 trillion for the U.S., while imports totaled $1.818 trillion, versus $2.299 trillion in the U.S.

While China posted a $231.1 billion trade surplus last year, the U.S. incurred a trade deficit of $735.7 billion.

At its current rate, China is projected to take over the U.S. as the world's largest economy by 2025.