Romans 9:11

( For the children being not yet born, neither having done any good or evil, that the purpose of God according to election might stand, not of works, but of him that calleth;)

Before Jacob and Esau were born, God already knew the characters each would develop. While they were still unborn and had done neither good nor evil, He declared that the elder would serve the younger. That declaration placed the younger in the chosen position as part of God's purpose according to election. It did not rest on birth order, nor on the special privileges belonging to the firstborn, but on Him who calls.