What is the meaning of [To give a run for one’s money]

To compete with someone at their level and make them really work for their win. “Joe really gave me a run for my money in the chess tournament. He almost beat me!”