Spanish and Portuguese are languages that share the same root: Latin. In addition, about 80% of their vocabulary is shared and their grammatical structures are very similar, so if you are a Spanish speaker, it will probably be much easier for you to learn Portuguese online than for a person who is not a native speaker of Spanish.
Even so, it is important that you take online Portuguese classes to study the language correctly, detect the differences that exist with Spanish and learn the correct pronunciation of words from the beginning.