Functionally they have the same meaning, “I can speak Japanese”.
「。。。」ことができる koto ga dekiru literally means ‘able to do this (verb)’. So “nihongo wo hanasu koto ga dekimasu” could be more literally translated as “I can do the action of speaking Japanese”, which of course you wouldn’t say colloquially in English. In Japanese however it’s perfectly fine to use and sounds a bit more polite than the second sentence.
The second form 話せます hanasemasu is the conjugated form of hanasu 話す which indicates the ability to do something (can speak). So in this case the literal translation is the same as what you would say normally in English. Again, this form is also fine to use in Japanese, and is more common to hear in regular conversation.
Hopefully that answers your question!
This reply was modified 1 year, 3 months ago by jolforummod.