Returning the ball before it makes contact with the surface is called volleying in table tennis. I found this article on volleying which does a great job of explaining the rule for points awarded for a volley. The exact rule regarding volleys has been mentioned in the article but I have decided to add an excerpt of the explanation of the rule here, which is much easier to comprehend.
If there's a chance that the ball might hit the table tennis table because it's still travelling towards it, your opponent would lose the point if he prevented it from doing so by volleying and/or obstructing it.
If the ball has already passed over the table and/or is travelling away from the table, your opponent wins the point whether he volleys and/or obstructs it or not.
The crucial criterion is whether the ball was going to make contact with the table or not before your opponent volleyed it. In your case, it seems it was not going to make contact with the table, so the point is awarded to your opponent even if he volleys the ball on or off the table.