There is a continuous tradition of sporting swordplay going back to the ancient world. The role of Spain in this history is probably misunderstood--Spain is often cited as the origin of the rapier, which strongly informed the development of fencing and duelling from the 1500s onward, but that is more of a statement about particular weapon styles than a statement about the origins of sporting play.
Sporting play not only pre-dates the rapier, but post-dates it in non-rapier forms right into the modern era. The 1904 Olympic Games included Single Stick, a traditional form of English fencing that drew from an older folk broadsword tradition. There were many other folk stick fencing systems used throughout Europe, including la canne and le baton in France, jogo do pau in Portugal, and others. Some continue to be practiced as sport to this day.
Prizefighting, today associated with boxing, was originally a fencing event. (Fencing master James Figg introduced bare-knuckle fights as a warm-up act to the prizefights in the early 18th Century, and they soon took over in popularity.) Prizefights go back to the medieval English fencing master guilds, who taught a medley of arms including quarterstaff, two-handed sword, sword and shield, etc. If you trained to be a master of arms, your final exam was essentially fighting off all the other masters, using all of these weapons. These were public events, popular and well-attended, and fairly lucrative--the graduating master used the proceeds to setup their first school. They continued after the Restoration in a form that was less formal and more explicitly entertainment-oriented. The later prizefights were notoriously bloody, and therefore insanely popular, although the participants were skilled enough that fatalities were rare. It was essentially the WWE of the day. (This was the environment that inspired Figg to warm up the crowds with fisticuffs.) [cf. The English Master of Arms, J.D. Aylward]
The medieval tournament included lots of sword fighting as part of the general melee. These events evolved to use explicitly bated or dulled weapons by the 13th Century or so, and specialized armour by the late middle ages, so even the basic equipment was diverging to explicitly sporting forms.
As for ancient Rome, the most obvious sporting events to consider were the Gladiatorial combats. Popular imagination, driven by Hollywood depictions, imagines that the Gladiator ring was basically a deathsport, and therefore more of a bloodthirsty entertainment than a "friendly" sport. The reality was more complex, with gladiator fights serving multiple purposes, many of which were religious and political in nature. The bloodiest events involved prisoners who were sentenced to die, in which violent death was the expected outcome, of course. Less bloody were the games that honoured deities, political figures, and departed notables; mercy would be shown to gladiators who performed with sufficient spirit and vigour to honour the patron of the games. Least deadly were the celebrity combats involving superstar gladiators, who (much like the aforementioned prizefighters) could put on fabulous shows and earn huge amounts of money for themselves and their owners, without undue risk to themselves.
As many as half of gladiators may have been volunteers, which seems unlikely if a quick and violent death was the likely outcome. The most successful gladiators lived lives of wealth and luxury, and were notorious sex symbols who were often involved in political sex scandals. Well-trained gladiators would only fight two or three times per year, and they had good food, lodging, and healthcare in the meantime. So it was probably a lot like being a champion boxer, except that your risk of getting knocked unconscious was replaced by getting a serious sword wound. It was a reasonable choice for many.
The oldest example of competitive swordplay that is commonly cited is from the time of Rameses III in ancient Egypt. Stone carvings on temples near Luxor depict a sort of stick fighting, with protective gear on the arms and head. It's hard to say how this sport worked, since it is so far removed from us, but someone has tried.
We have documentation of sporting events having taken place throughout Europe using various different sword types and styles from *at least* as early as the 15th century. In Germany, with which I'm most familiar, an individual event was known as a Fechtschule (fight-school), and was intended to display the skills of those who trained in the various martial arts of the time. Many of these, at least by the 15th/16th centuries were among the rising burgher classes in the cities, and practiced as a hobby, and to gain the skills required to fulfill marital duties as part of their guild(s) to the city (standing as night watch, guarding gates, etc).
This document is a quick read, and more comprehensive introduction to the context of these events than I can give: https://www.researchgate.net/publication/319450620_The_Fechtschulen_Historical_Context
Suffice to say, there has been a fair amount of research on what was going on, and how it was managed in various places, and how it changed over time - in many cases we still have the original town records, of the guilds, which mention events, sometimes even give us specifics such as the rules of the contests. People with far more knowledge that I can be found at r/wma.
We also know that there are at least some links between these contests, the fencing guild of a given city, and overall fencing guilds in many cases (at least the Marxbruders -Brotherhood of St. Mark- of Germany, which held royal patents from the Holy Roman Emporor). This also may tie the regular training of the city fencing halls to the Landsknechts, and to fencing masters who would also train individuals for judicial duels. Again, I'm aware of the research, though I don't offhand know the specific findings...