A party that has criticized President Trump's threat to take over Greenland won an election there, but may have to govern with a pro-White House opponent.