DES MOINES — Sen. Ted Cruz of Texas scored a hard-fought upset win over businessman Donald Trump in the Iowa Republican caucuses Monday night, while former secretary of state Hillary Clinton and Sen. Bernie Sanders of Vermont were locked in a virtual tie on the Democratic side with most of the votes counted. Cruz made good on his bet that a methodical campaign organization would eclipse Trump’s media dominance in the first test of Republican voters. With 99 percent of the precincts reporting, Cruz was beating his rival by more than 5,100 votes, with Sen. Marco Rubio of Florida a close third. Cruz appeared to capitalize on deep support from religious and social conservatives and showed that old-fashioned retail politicking could overcome Trump’s massive political rallies in the Hawkeye State. [How Ted Cruz won Iowa] “God bless the great state of Iowa,” Cruz told supporters at his campaign’s Iowa headquarters after embracing his wife, Heidi. “Tonight is a victory for the grass roots. Tonight is a victory for courageous conservatives across Iowa and all across this great nation. Iowa has sent notice that the Republican nominee and the next president of the United States will not be chosen by the media, will not be chosen by the Washington establishment, will not be chosen by the lobbyists.”