Since version 1.5.0, Pact of the Seas, it's possible to enable "Shared Victory" at game creation. This will share the victory of an alliance member with the rest of the alliance. From the original patch notes:
Shared victory
Ever had a multiplayer game where the last dozen turns are rife with suspicion and mistrust, as you and your allies all separately angle for the victory, knowing full well that only one of you would win, hoping there was a way you could share credit for your hard-won victory? Hope no more! We added an option at game creation that enables shared victories: basically, if you win, you win for whatever victory you earned, and your allies get the shared victory.
Make sure you tick the option at game creation, because it can't be changed later on. Take comfort in the knowledge that if the option is activated, you are safe(r) from last-minute betrayal!