After some answers I got it.
The answers in other threads didn't work right away in Spacemacs (I'm really new to Emacs world so I don't know why), but mixing parts of them I managed to do it.
It's still not perfect. I would prefer to get the color from Emacs theme instead of using the color that hl-line figures out it should use, but I don't understand how to do it.
Thank you all for your help!
(defun dotspacemacs/user-config ()
(let ((w (length (number-to-string
(count-lines (point-min) (point-max))))))
(concat "%" (number-to-string w) "d"))))))
`((t :inherit linum :background ,(face-background 'hl-line nil t)))
"Face for the current line number."
(defun my-linum-format-func (line)
;; (propertize (format linum-format-fmt line) 'face 'linum)
(propertize (format linum-format-fmt line) 'face 'my-linum-hl)
(propertize " " 'face 'mode-line)))
(setq linum-format 'my-linum-format-func)))