The Elf Queen Galadriel gives Frodo a magical phial before he leaves her protection.
The phial contains the light of Eärendil, a star sacred to the Elves, which will give Frodo light when he needs it.