"I'm the shooter," the affidavit, which was seen by Efe news on Friday, quoted Patrick Crusius as saying when he surrendered to police after pulling over and exiting his car at an intersection near the Walmart that was the scene of the massacre on August 3.
The affidavit, drawn up by El Paso police detective Adrian Garcia, said that Crusius, 21, waived the right to an attorney and agreed to talk to the officers.
The shooter told police that he drove more than 10 hours from his home in Allen, Texas, near Dallas, with an assault rifle and a large quantity of ammunition.
"The defendant stated once inside the store, he opened fire using his AK-47, shooting multiple victims," according to the affidavit, whose contents were first reported by The Washington Post.
"The defendant stated his target were Mexicans," Garcia wrote.
The 83 per cent Latino city lies just across the Rio Grande River from Ciudad Juarez, Mexico.
US federal authorities characterize the El Paso massacre as domestic terrorism and Crusius might be charged with a hate crime as well as multiple counts of murder and attempted murder.
Crusius could face the death penalty if convicted.
Investigators are trying to confirm whether Crusius was the also author of a statement posted online roughly 20 minutes prior to the shooting that called for halting an "Hispanic invasion" of Texas.
President Donald Trump has repeatedly used the word "invasion" to describe the flow of undocumented immigrants into the US.
Eight of the 22 fatalities were Mexican nationals and Mexico's Foreign Secretary, Marcelo Ebrard, has raised the possibility of seeking Crusius' extradition to face charges south of the border.
Senior US officials are scheduled to travel to Mexico City on August 13 to discuss the events in El Paso and other issues, Ebrard said.
Thirteen hours after the bloodbath in Texas, 22-year-old Connor Betts opened fire on pedestr in an entertainment district of Dayton, Ohio, killing his own sister and eight other people before he was shot dead by the police.
( With inputs from IANS )