In addition to Andrew Swann's specific answer for TeX files, the more general way to set the mode by file extension is to put a new entry (or adapt the existing one) in the
From the manual:
This variable contains an association list of file name patterns (regular expressions) and corresponding major mode commands. Usually, the file name patterns test for suffixes, such as ‘.el’ and ‘.c’, but this need not be the case. An ordinary element of the alist looks like (regexp . mode-function).
(("\\`/tmp/fol/" . text-mode)
("\\.texinfo\\'" . texinfo-mode)
("\\.texi\\'" . texinfo-mode)
("\\.el\\'" . emacs-lisp-mode)
("\\.c\\'" . c-mode)
("\\.h\\'" . c-mode)
So one would ordinarily make a permanent change to the list with something like:
(add-to-list 'auto-mode-alist '("\\.tex\\'" . latex-mode))
Note the backslashes, which escape special characters.
The alist works because the first matching value in the list will be used. You can therefore add to the front of the list regardless of the original contents for that file type, and your new value will be used.