The Defiant is a "pure" warship, while the Galaxy class is a multi-purpose vessel so I believe a Defiant could defeat a Galaxy, if it is the USS Defiant given it has ablative armour and a cloaking device it increases that ship's odds of a victory.
There is no doubt that the Galaxy class is a powerful combatant, the E-D didn't last 8 years just because Picard blinded the enemy with the shine off the top of his head. In "Sacrifice of Angels" was probably the most telling showing of a Galaxy in combat when they incredibly easily dispatched two Galor class vessels. It is a massive vessel and if you were to just completely outfit it into a warship it would crap all over the Defiant in killing power. Its size also allows it to spread its damage over a large area, hits that penetrate the shields and hull have to do more work to hit really important things.
As for the Defiant it got the hero ship treatment, which skews it towards uber. For example in "Tears of the Prophets" a Galaxy is engaged by a OWP and it immediately penetrates that ship's shields and starts burning away the hull (though unlike the warbird in the earlier shot the Galaxy keeps going) whereas the Defiant takes multiple hits with no signs of damage, which flies in the face of all the other scenes we see. No ship other then the Defiant seems to resist the enemy fire at all. The Defiant also was able to take out a Keldon class just as quickly as the Galaxys took out the Galor in SoA and the ship was been controlled by Maquis and not a highly trained Starfleet crew who have been working with the ship for several months.
Compared to the other ships of its size the Defiant is the clear winner, BoPs, Hidekis, Jem'Hadar attack ships and Breen warships exploded if the Defiant thought about heading in their direction. Been small the Defiant appears to be quicker and more manoeuvrable at impulse but it is compact and once you get past shields there is less hull between the enemy and important systems. However, the Defiant has shown to be hardy without shields, though 2 minutes without shields and with a Vor'cha on its tail is thought to be a bridge too far. In "Changing Face of Evil" the Defiant is just about the last Fed alliance ship to go explody under Breen fire yet it was the first disabled. The Defiant and three BoP were too much for a Jem'Hadar battle cruiser (a surprisingly large one at that) in SoA, which is given its size could be comparable to a Galaxy class.
As for verse Fed ships they only time we see it do that is in "Paradise Lost" when it goes up against a uprated Excelsior class. In that battle despite letting the Lakota get in the first half a dozen hits (the first two dropped its port shields to 60%), both going to disable the other and seeing the Lakota get 100% hits and the Defiant missing 1/3 of the time with phaser. When it comes down to the end the Defiant is ahead and can finish the Lakota with one more good hit. So now it is would a Lakota type Excelsior beat a Galaxy?
It would be a tough fight between the two ships and as said above the crew would probably make the most significant difference. The one that is better able to handle the situation, the one that is more skilled at their jobs, the one that not only knows their vessel but their opponent as well will be the one left standing. If it is the Defiant vs E-D, the writers would probably stalemate it or give the victory to the one that had Worf on it.