If you're close to victory in a fight or otherwise have an advantage, sometimes you'll get a theme playing to tell you. Can happen in all games. Especially likely in boss battles.
This serves two main purposes. First, it tells the player that he is close to victory, something that may not be immediately clear from the data on the screen, particularly with Marathon Bosses. Secondly, a good dramatic near-victory theme can get a player's blood going and make the game more exciting. This potentially makes use of a Variable Mix.
See also Songs in the Key of Panic.
Played with in Nier, where as the final battle with the Shadowlord draws to a close, the Shadowlord's dramatic theme grows quieter until a music box version of his theme plays instead, signifying his utter despair and complete loss of hope.
For every world boss and Crush Bomber battle in Bomberman Generation, once the boss' life is down to around a heart and a half the boss theme is replaced with the more upbeat battle mode theme.
Happens in Warriors Orochi when you eliminate most to all of the officers in a level except the last one, or a good number of the enemy mooks.
In Bayonetta, the bosses each has their own Ominous Latin Chanting theme, but except for one, once you beat them enough, that boss theme will be replaced with a short piano piece, which is later replaced by yet another theme when you use your Finishing Move.
Tokimeki Memorial 2 has a variation of this. When trying to win the heart of Ensemble Dark HorseBroken Bird Kaori Yae, if you manage to get her to Tokimeki State and see her mandatory Event where she confesses to the male hero her painful past, allowing her to heal her heart and turn back to the Genki Girl she was, her somber, quiet Leitmotif tune will change to a more peppy, cheerful version, meaning you're on really good tracks towards getting her Happy Ending.
In Super Solvers: Gizmos & Gadgets, the background music for each race will turn into a triumphant theme if the player's vehicle is ahead of Morty's. The opposite occurs if Morty is ahead.
Age of Mythology plays one of three epic orchestral themes when you unleash a God Power (particularly fitting if you just ravaged the enemy base with an Earthquake, tore through attackers with a Tornado, or just blew up everything with a Meteor Strike)
The first three Boktai games all have the Pile Driver music, which gets steadily more epic as you get closer to purifying the boss.
Ultima Underworld II has three battle themes: one when you're close to victory, the standard one, and one when you're close to defeat.
Nearly all of the Fire Emblem games have a tune that plays when you've cleared out most of the enemies (in the GBA/DS games, its when there's only one enemy left on the map - and its often the Boss, but not always), which can get annoying if you grind for Supports.
"The Genesis" in Persona 4 is an oppressive, somber True Final Boss theme with bombastic brass and ominous drums. As the battle rages, however, a heroic reprise of "I'll Face Myself"'s main melody breaks in; eventually, the music becomes an all-out, triumphant version of "Reach Out To The Truth."
About half the final fight of Mass Effect 3 will be without music, with the screams and sounds of battle being the only things you'll hear. But then, when things get the most hairier this theme will start playing. It could be considered a Near Victory Fanfare for each side, since both armies could win at any moment (especially the enemy), and the one who wins the fight will accomplish their objectives.