*After some minutes, Greer finally convinced security to let Clark and Co. go. He walked in a hall to show them to their rooms alongside O'Connor. *
Greer: just for a short update. I got bad news: Sophea has been killed.
O'Connor: What?! how?
Greer: Apparently the guy who asked the commander for a ship in front of the hospital had gone berserk at the jedi temple.
O'Connor: what about Flax?
Greer: He's doing pretty well. He's angry, but not openly so, and he isn't a mess either.
O'Connor: What about Sellena?
Greer: I haven't seen her yet. I believe she's visiting Deac.
O'Connor: Did he get here all right?
Greer: Yes. Here's your rooms.
Vader's wife was very pregnant when she died 19 years ago. All of a sudden a 19 year old who is very strong in the force and has a distinct resembalance to him in his younger days rolls in from Vader's home planet with his old Master Obi-Wan (Who was the ONLY other person preset at the time his wife died. And to boot, the kid's last name is Skywalker.
So in answer to your question, he knew Luke was his son because his name is Darth Vader, and not Darth Retard.
-Forum post on why Vader knew Luke was his son.