All of the victims were taken to an area hospital. Their conditions were not immediately known.
Officials familiar with the investigation said the suspect in custody, identified as 22-year-old Jared Lee Loughner, claimed he acted alone.
However, authorities said they are searching for a second possible suspect, a white man in his 50s who allegedly accompanied Loughner to the event.
Federal law enforcement at the scene confirmed Giffords, 40, was the intended target and was shot at point-blank range with a semi-automatic pistol with an extended clip.
Loughner was tackled by two men before he could fire more shots.
A spokesman for Giffords, C.J. Karamargin, said an unspecified number of Giffords' staff members were injured in the shooting. Also, congressional officials said an aide to the Democrat was killed.
According to an Arizona congressional staffer, an eyewitness called a Congress member and described that, "A man came out of nowhere shooting so fast. He unloaded two clips almost immediately, everyone hit the ground. People came and took down the gunman."
Giffords, a Democrat, was at an event called, "Congress on Your Corner" at a Safeway supermarket about 10 a.m. in northwest Tucson.
During a press conference, President Barack Obama called the shooting an "unspeakable tragedy."
"Gabby is as tough as they come and I am hopeful that she is going to pull through," Obama said. "Such a senseless and terrible act of violence has no place in a free society. I ask all Americans to join me and Michelle in keeping Representative Giffords, the victims of this tragedy, and their families in our prayers."
Several other officials released statements. They can be read here here.
Federal law enforcement officials were poring over captured versions of a MySpace page that belonged to Loughner. He allegedly also published videos on Youtube weeks ago under an account "Classitup10." The MySpace page, which was removed within minutes of the gunman being identified by U.S. officials, included a mysterious "Goodbye friends" message published hours before the shooting and exhorted his friends to "Please don't be mad at me."
In one of several YouTube videos, Loughner described inventing a new U.S. currency and complained about the illiteracy rate among people living in Giffords' congressional district in Arizona.
"I know who's listening: Government Officials, and the People," Loughner wrote. "Nearly all the people, who don't know this accurate information of a new currency, aren't aware of mind control and brainwash methods. If I have my civil rights, then this message wouldn't have happen (sic)."
Initial reports said Loughner was an Army veteran. However, Army officials said Loughner was never enlisted. Officials said he attempted to enlist but was rejected for service, but they declined to state why he was rejected.
Giffords was re-elected to her third term last November. She was a member of the Arizona House and Senate before arriving in Washington.
She first won election to Congress amid a wave of Democratic victories in 2006. In November, she edged a tea party favorite.
Gifford's office had received death threats in the past over healthcare reform and immigration.
Giffords is married to astronaut Mark Kelly, commander of STS 134, the last scheduled space shuttle mission which is supposed to launch in April. The couple has two children from Kelly's previous marriage.
The judge killed during the shooting was U.S. District Court Judge John M. Roll, who was nominated to the bench in 1991 by George H. W. Bush.
ABC News and the Associated Press contributed to this report.