Exodus 4:22 And thou shalt say unto Pharaoh, Thus saith the LORD, Israel is my son, even my firstborn:
The nation Israel was not the first and not even born but chosen.
Deuteronomy 25:6 And it shall be, that the firstborn which she beareth shall succeed in the name of his brother which is dead, that his name be not put out of Israel.
The second son is made firstborn when the elder dies.
1 Chronicles 26:10 Also Hosah, of the children of Merari, had sons; Simri the chief, (for though he was not the firstborn, yet his father made him the chief
The second son made firstborn by his father.
Psalms 89:27 Also I will make him [David] my firstborn, higher than the kings of the earth.
David chosen as firstborn, by God, although he was not the eldest of his brothers.
Jeremiah 31:9 They shall come with weeping, and with supplications will I lead them: I will cause them to walk by the rivers of waters in a straight way, wherein they shall not stumble: for I am a father to Israel, and Ephraim is my firstborn.
Ephraim called firstborn, by God, although not the oldest son.