Dusseldorf police announced on Sunday that they had arrested the man after they had launched a search for the assailant after the daylight attack on the grandmother.
The elderly woman had left in the church in the heart of the German city centre on October, 2, when the assailant pushed her into a narrow alley between two pubs.
In the alley, which is usually closed off to the public and used for storing rubbish from the pubs, the perpetrator is said to have demanded money from the woman before sexually assaulting her.
Dusseldorf police were able to construct a likeness of the suspect after a police officer recognised the man at a trains station.
Local media reported that the DNA of the man, a Moroccan migrant who had previously lived in Spain, matched the traces found at the crime scene.