The car Roof was driving was left at the Kangaroo Express gas station on highway 74 in Shelby, about 20 miles away from Charlotte.
Roof was arrested after someone in Shelby saw a driver acting suspiciously, and called police.
Roof put up no resistance after a citizen tip led police to his car Thursday morning in Shelby, North Carolina, Police Chief Greg Mullen said.
"Acts like this one have no place in our country," said Attorney General Loretta Lynch, who announced a Justice Department hate crime investigation. "They have no place in a civilized society."
Before Roof was arrested in Shelby, he was seen at the Shell gas station on Providence Road in Charlotte. The manager there tells our sister station in Charlotte that he bought a bag of chips before he left. They have turned over their surveillance video to the FBI.
Public records show Dylann Storm Roof was arrested in Lexington County, SC on drug charges earlier this year.
The suspect opened fire during a prayer meeting inside a historic black church in downtown Charleston on Wednesday night, killing nine people, including the pastor, in an assault that authorities described as a hate crime.Police said Thursday morning the shooter was inside the church for more than an hour before he started shooting. There were 13 people inside the church when the shooting began, including the shooter. Three people survived the shooting, and the FBI is interviewing them now.
The shooter remained at large Thursday morning and police released photographs from surveillance video of a suspect and a possible getaway vehicle.
Police Chief Greg Mullen said he could not offer a make and model on the dark colored sedan because investigators were not certain about what is shown in the video.
The victims of the shooting were six females and three males, Mullen said Thursday morning. He did not give other details about the victims.
Mullen said he believed the attack at the Emanuel AME Church was a hate crime. The suspect was described as a white man in his early 20s.
"This is a very dangerous individual," Mullen said during a 6 a.m. news conference.
Mullen said the scene at the church was chaotic when police arrived, and the officers thought they had the suspect tracked with a police dog, but he got away.
"We will put all effort, we will put all resources and we will put all of our energy into finding this individual who committed this crime tonight," he said.
The FBI will aid the investigation, Mullen told a news conference that was attended by FBI Special Agent in Charge David A. Thomas.
Charleston Mayor Joseph P. Riley called the shooting "the most unspeakable and heartbreaking tragedy."
"The only reason that someone could walk into a church and shoot people praying is out of hate," Riley said. "It is the most dastardly act that one could possibly imagine, and we will bring that person to justice. ... This is one hateful person."
State House Minority leader Todd Rutherford told The Associated Press that the church's pastor, state Sen. Clementa Pinckney, was among those killed. South Carolina state legislators offered the condolences and remembered Pinckney on the floor of the capitol building.
Pinckney 41, was a married father of two who was elected to the state house at age 23, making him the youngest member of the House at the time.
"He never had anything bad to say about anybody, even when I thought he should," Rutherford, D-Columbia, said. "He was always out doing work either for his parishioners or his constituents. He touched everybody."
The attack came two months after the fatal shooting of an unarmed black man, Walter Scott, by a white police officer in neighboring North Charleston that sparked major protests and highlighted racial tensions in the area. The officer has been charged with murder, and the shooting prompted South Carolina lawmakers to push through a bill helping all police agencies in the state get body cameras. Pinckney was a sponsor of that bill.
In a statement, Gov. Nikki Haley asked South Carolinians to pray for the victims and their families and decried violence at religious institutions.
"We'll never understand what motivates anyone to enter one of our places of worship and take the life of another," Haley said.
Soon after Wednesday night's shooting, a group of pastors huddled together praying in a circle across the street.
Community organizer Christopher Cason said he felt certain the shootings were racially motivated.
"I am very tired of people telling me that I don't have the right to be angry," Cason said. "I am very angry right now."
Even before Scott's shooting in April, Cason said he had been part of a group meeting with police and local leaders to try to shore up relations.
The Emmanuel AME church is a historic African-American church that traces its roots to 1816, when several churches split from Charleston's Methodist Episcopal church.
One of its founders, Denmark Vesey, tried to organize a slave revolt in 1822. He was caught, and white landowners had his church burned in revenge. Parishioners worshipped underground until after the Civil War.
The Associated Press contributed to this story.