A close-run win....what could I have done better?


18. Ne7 gets you a bishop, then he should respond Kg7, then you could take the G5 pawn with your bishop.
In all fairness though, I'm mediocre at best myself, so take that advice with a grain of salt.

study chess openings and keep in mind that in every move you'll gain something- a piece or a position

The opening is pretty horrible.
3. Bd3 blocks in the pawn on d2 and that in turn limits your bishop on c1. Better here would be 3. Nf3 or 3. d4.
5. Na3 puts your knight on rim ("a knight on the rim is dim") which means that the knight cannot much contribute to the centre which is where your action is. So far your moves have not been harmonious. The bishop move traps you d pawn and queen bishop; that, and the c3 move, means your queen knight has nowhere to go but the horrible a3 square.
7. Bb5+ is a poor move. It moves a piece twice. That's not advisable in the opening when it is crucial to get all your pieces out quickly and efficiently. Of course, it works out for you because black's response (7. ... Kf8) is ludicrous when he could easily play 7. ... Bd7 (blocking the check and developing a piece).
9. Ba4 loses a piece if black plays properly. For example, 9. ... b5 10. Bb3 c4 and the bishop is trapped!!
You're right that 12. Qe2 loses the knight - but what else could you do? The knight had very few squares to move to other than back to g1!!
18. a3 loses another piece. Black now has king, bishop and knight all attacking the knight on f5. For example, 18. ... Nxf5 19. Bxf5 Bxf5.
You know how to pieces and you have appreciation for the relative values of pieces. You also understand some basic tactics and combinations. However, probably the weakest part of your play was the lack of opening principles. You should read a beginner chess book and focus on an opening such as Ruy Lopey, Study the first 7-8 moves made by each player and try to understand why these moves are made and how they affect the subsequent game.
In short you need to study the opening principles of chess.
Hope this helps.
Steve
I'm a beginner to chess, too, so here are some tips. They're from a beginner, so I guess they're only that valuable.
5. Na3 is usually not a good move (same with Nh3). In this case, if black sacrifices his Bishop on your Knight, you're stuck with doubled pawns on an outside file. If you played 3. d3 instead, there would be room to place your Knight at d2.
6. b4 gives your opponent the chance to be up a pawn and gives his Bishop good position on b4, but he doesn't take it. You should start thinking about chains of moves. The first step in this is to think about a series of captures to see who would end up in material.
Regardless of whether or not you want to keep the Knight, 12. Qe2 wasted time, since you already knew you were going to use the Queen to capture the pawn on the same diagonal. If I were to sacrifice my Knight, I would have fought for position and the offensive with 12. Nxg5 so that you force Black's move as well as drive his pawns outward and can make your own next.
18. You should have played 18. Nxe7+. You take Black's Bishop, which he cannot retaliate due to the double check.
21. Qe3 places your Queen in line with your King. While it may not be at an immediate risk, it's generally not a good idea to present the opportunity for your Queen to be pinned to your King.
Other than that, watch out for leaving pieces unprotected, especially what diagonals become exposed when a piece moves. I think Black would need more advice than you, since he or she had an insane amount of missed opportunities, as opposed to blunders.