"Nearer, My God, to Thee" is a 19th-century Christian hymn by Sarah Flower Adams, based loosely on Genesis 28:11–19, the story of Jacob's dream.
Genesis 28:11–12
"So he came to a certain place and stayed there all night, because the sun had set. And he took one of the stones of that place and put it at his head, and he lay down in that place to sleep. Then he dreamed, and behold, a ladder was set up on the earth, and its top reached to heaven; and there the angels of God were ascending and descending on it..."
The hymn is well known, among other uses, as the alleged last song the band on RMS Titanic played before the ship sank.