It happened just after 2 p.m. in the 400 block of Scott's Ridge Trail. The child was shot in the lower leg.
Police said the four-year-old and his three-year-old brother were playing in the car when they opened the glove compartment and discovered a handgun.
"He somehow got the gun out of the car and then the gun discharged and he (was) shot in the leg," said neighbor Carol Medins.
Police say both the gun and car belonged to a family friend. Neighbors said it was the oldest daughter's boyfriend.
Police say the children's mother was home at the time.
"She takes really good care of those kids," said Medins. "She's always out with them."
The child was taken to WakeMed. His injuries were described as non-life threatening.
No charges have been filed.