A police spokeswoman said in a statement that he confessed to shooting out of the window after police found an air rifle in his house.
The boy had been playing with other children on a footpath near Berlin's Ostbahnhof station when he suddenly realized that he was bleeding.
He ran home and his mother called the police.
Officers initially arrested four men, two women and a 13-year-old girl before the man took responsibility for the shooting.
Doctors operated on the boy overnight, and police said on Friday that he was out of danger and had been allowed to leave intensive care.
The spokeswoman said the boy had been very lucky.