Exclusive

William Shatner pulled a Christmas surprise out of his stocking for some hungry cops stuck working on Xmas ... filling their bellies with a tasty holiday spread.

Law enforcement sources tell TMZ ... the 'Star Trek' legend paid a visit to his local police station on Christmas day, pulling up with trays of corned beef and pastrami sandwiches and contributing the grub to a potluck for police.

Our sources say William also came bearing other tasty gifts from Brent's Deli -- bagels, lox and cream cheese. All part of a complete breakfast!!!

Captain Kirk kept spreading holiday cheer with the LAPD ... we're told William thanked those on the force for working on Christmas and also left behind a nice holiday card for the station.

All told, our sources say William dropped a few hundred bucks to feed the guys.