It happened Sunday night near 79th Street and Kedzie where the Norfolk Southern officer was on duty. Police say a man attacked him after being told he was trespassing on the railroad tracks.
The officer called for help during a struggle, but police say the suspect was still beating the 39-year-old victim when they arrived.
The suspect was taken into custody.
The officer was hospitalized. His injuries were not life-threatening.