The two-legged, season-opening tie, which pits the La Liga champions against the King's Cup holders, will be played in the Bird's Nest stadium in the Chinese capital, the federation said in a statement on their website.
They did not publish financial details but Spanish media reported that the deal, which has a seven-year duration and needs approval by the RFEF general assembly, would net the federation around 40 million euros.
Spain play China in Seville on Sunday in the world champions' final warm-up match before they begin the defence of their European title at Euro 2012 starting on June 10 against Italy in Gdansk, Poland.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.