The Royal Blues dominated the game from start to finish and could have won by a bigger margin had they not squandered their chances.
Thereafter, though, it was all Schalke for the rest of the first 45 minutes.
Klaas-Jan Huntelaar came close to breaking the deadlock on two occasions before the half-time interval, and Farfan too tried his luck again but in vain.
Afellay was denied again by Rakovsky in the early minutes of the second period, and then Huntelaar failed to keep his header from a Farfan delivery on target.
Nuremberg were better in creating chances of their own in the second half, Per Nilsson and Kiyotake testing Unnerstall.
Schalke eventually broke the deadlock in the 77th minute when Farfan shot home Christian Fuchs's cross.
Huntelaar came close to adding to the tally twice in the final minutes, but the hosts had to settle for a 1-0 victory that sees them close the gap on leaders Bayern Munich to four points for until Sunday at least.