Manchester United had 11 shots on target before Scott McTominay broke the deadlock
McTominay, introduced with less than 10 minutes remaining, fired in the winner after fellow substitute Jadon Sancho teed him up in the box.
The result means United remain three points behind Group E leaders Real Sociedad, who beat Sheriff Tiraspol 3-0 for their fourth win in as many matches in the competition.
United dominated and had several huge chances to score but were left frustrated until McTominay's winner.
"In this team there is a lot of creativity and scoring capabilities. Sometimes you have a night where you will not succeed. Today was that night," said Ten Hag.
"But the good thing was the team keep going and they don't give up. They keep believing and in the end we get the reward. That is the way we have to do it.
"I am really happy with that. It is about the spirit in the team and the squad. It is not just about the 11 players.
"Sometimes it works like that. Substitutes can have an impact when they have the right attitude and the right focus."
Omonia goalkeeper Francis Uzoho was undoubtedly the visitors' best performer as he kept out 11 of United's 12 shots on target.
But he could do nothing to stop McTominay's strike in the 93rd minute, having saved three big chances for Marcus Rashford in the first half.
Casemiro, who started in midfield alongside Fred, struck the crossbar in the first half too, before Fred headed over the bar from an unmarked position in the box.
Cristiano Ronaldo could not take his chances either and McTominay had smashed a wild shot into the stands before finding the composure to score the winner in front of an elated Old Trafford crowd.
Victory means United's hopes of topping the group remains within their grasp. They face Sheriff Tiraspol at home in their next match on 27 October.
Omonia, who had few opportunities at the other end, could have scored themselves on the stroke of half-time but Bruno Felipe did not square it for team-mate Andronikos Kakoullis who was completely free in the middle.
Neil Lennon's side, who went 1-0 up in the reverse fixture last week before Rashford's double helped United claim a 3-2 win, were cheered on by 4,500 visiting fans.
"I am very proud of the team. We were a few minutes away from one of the greatest results in this club's history," said Lennon.
"We have made great strides in a short space of time. We came close to getting a draw against Sociedad and obviously tonight and last week. The players have been fantastic since I came in March.
"The fans were incredible. They looked like they enjoyed the full experience. They showed how much pride they have for the club. To bring 4,000-odd people from Cyprus is incredible.
"I think this trip has put Omonia on the map a little in Europe. We need to build on that."
Ten Hag noted the positive reactions of his players to setbacks in his pre-match programme notes and they were tested again on a largely frustrating evening at Old Trafford.
It looked like United were going to rue the missed chances as full-time approached but they were building pressure. When the fourth official showed five added minutes on the board, a roar inside Old Trafford suggested the belief remained that they would eventually find a winner.
McTominay, who replaced Casemiro after 81 minutes, was in the right place to collect Sancho's pass after neat footwork from the winger on the left.
The Scotland midfielder took one touch before firing it past Uzoho, who minutes earlier must have thought he was heading home to a heroes' welcome in Cyprus for his outstanding performance.
While there will still be concerns for Ten Hag as his side clearly lacked ruthlessness, the result means they have now won three games in a row since the 6-3 humbling at Manchester City.
"The performance before the box was good but the finishing was not that good. Let's hope we save the goals for another week," Ten Hag added.
-- Courtesy of BBC Sport