Is there a correct way to spell it or are both correct? Are there any formal references to the correct spelling?
Well, the Ukrainians (probably, majority of those who care) prefer to see that city name spelled as "Kyiv" in Latin script. (There were even some official tries (also see this and this) to convince others to call us in that way.)
But, still, that issue is outside of the scope of the Ukrainian language and of the sphere of influence of Ukrainians. We can only ask others to call our city in this way; not give any "orders" to other countries/nations/governments/peoples.