I learned the guitar playing by ear. As a kid I would just lock myself in my bedroom and play along with my CDs until my fingers were raw.
It's a lot of screwing up, starting the song over, and trying again until it sounds right. I started doing this about 20 years ago so I've had quite a bit of practice, but at this point it's really a great feeling to listen to a song on YouTube and know pretty much before I pick up the guitar whether I'm capable of playing it within an hour or so.
It just takes practice. Lots of it. Lots of trial and error. Lots of screw ups. And just embracing/loving the process.
Actually the last part is the most important, because I love playing the guitar. I love music. I play 5 different instruments and music is a deeply important part of my life. My desire to play along to the songs I love trumps wanting to learn it in a more traditional fashion. I could have taken guitar lessons or gotten a teacher to learn proper theory and all of that. But all of that stuff just got in the way of what I wanted to do: play the music I love. Now.
So just go out there and fiddle with your instrument and play along to stuff you like!