New Mexico maintained a one-game lead over four teams at the top of the Mountain West Conference.
The Cowboys tied it at 59-59 with 15 seconds left on a 3-pointer by Riley Grabau, but Greenwood's field goal with 9 seconds remaining put the Lobos back in front.
After a Wyoming turnover Greenwood was fouled and his two free throws wrapped up the victory with 7 seconds to go.
Cameron Bairstow scored 17 points for New Mexico (18-3, 5-1 MWC) and Greewood had 13 points along with 10 rebounds.
New Mexico bounced back from an ugly loss to San Diego State last Saturday during which the Lobos scored only 34 points.
Wyoming (15-5, 2-5) was paced by Derrious Gilmore with 15 points. The Cowboys have lost three in a row and four out of five.
Benedict Cumberbatch's dramatic reading of R. Kelly lyrics is just what you need
Jordana Brewster on Paul Walker: 'He was an enormous presence in my life'