El or la, and why the ending isn't enough
In English, a table and a book are both usually “it”. Spanish gives every noun a grammatical gender: la mesa (table) is feminine, and el libro (book) is masculine. This doesn't mean that objects have a biological sex; gender is a grammatical category that affects the words around a noun. Endings help, but they don't tell the whole story. Problema ends in a and is masculine; mano ends in o and is feminine. And agua takes el immediately before it, even though it remains feminine.
Learn the article with the noun
The definite article is el for masculine nouns and la for feminine nouns. Write new vocabulary as el libro, rather than just libro. That way you learn the gender together with the word and don't have to guess it every time.
El libro está en la mesa. The book is on the table. English uses the same word, “the”, for both nouns; Spanish distinguishes their genders.
La casa tiene un jardín. The house has a garden.
Gender affects more than the article. Adjectives follow it too, so la casa blanca forms a unit in which all three words agree in gender.
What the ending can tell you
Most words ending in -o are masculine, and most ending in -a are feminine. Words ending in -ción and -dad are usually feminine too: la estación, la ciudad.
La ciudad es pequeña. The city is small. The feminine gender of ciudad shows in the adjective form pequeña.
With nouns ending in -e or a consonant, the ending is often less helpful. There's el coche, but la noche; el papel, but la flor. Learn each noun and article together.
For people, grammatical gender usually follows the person you're referring to. Sometimes the ending changes (el profesor, la profesora); sometimes only the article changes (el estudiante, la estudiante).
Exceptions you'll meet early on
El problema no es grave. The problem isn't serious. A number of other words ending in -ma that came from Greek are masculine too: el tema, el sistema, el idioma. This doesn't apply to every word with that ending: la cama (bed) is feminine as usual.
La mano está fría. The hand is cold. It ends in -o but is still feminine.
La foto es de Praga. The photo is from Prague. Foto is short for fotografía, so it keeps its feminine gender. Similarly, la moto comes from motocicleta.
Other exceptions to the usual ending patterns include el día (day) and el mapa (map). They're common words, so you'll soon become familiar with them.
Why el agua is still feminine
Feminine nouns beginning with a stressed a sound normally take el immediately before them in the singular. This is a historically established form of the feminine article, not a switch to masculine gender. The noun's gender doesn't change, and its adjective stays feminine.
El agua está fría. The water is cold. Fría is correct, not frío. With a demonstrative, you say esta agua, this water.
In the plural, the ordinary form las aguas returns. If another word comes between the article and noun, you use la again: la misma agua. El aula (classroom) and el hambre (hunger) follow the same pattern.
Don't store this in your memory as a new masculine noun. Remember one sentence containing everything you need: El agua está fría.
From today, write the article and one sentence of your own with every new noun. You'll find a fuller explanation in the Spanish video course, and you can practise vocabulary with its articles using the Španělsky Hravě matching game.